C2022-003-Change-Textboxes-to-RTF-3

This commit is contained in:
2026-01-13 11:46:47 -05:00
parent 5e7d2431b3
commit f8865206e9
7 changed files with 135 additions and 57 deletions

View File

@@ -0,0 +1,31 @@
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);
}
}
}