32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace ctlXMLEditLib
|
|
{
|
|
public partial class roRichTextBox : RichTextBox // C2022-003 Symbols in RO Editor. Customized RichTextBox for RO Editor.
|
|
{
|
|
public roRichTextBox()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void InsertSymbol( int symbcode)
|
|
{
|
|
int position = this.SelectionStart;
|
|
string sym = string.Format(symbcode < 256 ? "\'{0:X2}" : @"\u{0}", symbcode);
|
|
string RtfPrefixForSymbols = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 FreeMono; } {\f1\fnil\fcharset0 FreeMono; } } {\colortbl;\red255\green0\blue0;\red0\green0\blue255; } \viewkind4\uc1\pard\fs24 \f1\fs24 ";
|
|
this.SelectedRtf = RtfPrefixForSymbols + sym + @"}";
|
|
this.SelectedRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\uc1 }";
|
|
this.Select(position, 0); this.SelectedRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\uc1 }";
|
|
this.Select(position, 0);
|
|
}
|
|
}
|
|
}
|