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

@@ -39,7 +39,7 @@ namespace ctlXMLEditLib
{
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.RichTextBox tbZoom; // RO Editor add symbols C2022 - 003
private ctlXMLEditLib.roRichTextBox tbZoom; // RO Editor add symbols C2022 - 003
/// <summary>
/// Required designer variable.
/// </summary>
@@ -88,7 +88,7 @@ namespace ctlXMLEditLib
/// </summary>
private void InitializeComponent()
{
this.tbZoom = new System.Windows.Forms.RichTextBox(); // RO Editor add symbols C2022 - 003
this.tbZoom = new ctlXMLEditLib.roRichTextBox(); // RO Editor add symbols C2022 - 003
this.btnSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();

View File

@@ -241,12 +241,12 @@ namespace ctlXMLEditLib
private bool dosaveflag;
private VlnXmlElement editelem;
private XmlDocument editdoc;
private RichTextBox zoomtextbox;
private roRichTextBox zoomtextbox;
// the following is used for handling images. Note that if we want to have more
// than one image defined in an ro, this should be become a list.
private RichTextBox GraphicsFiletextbox;
private RichTextBox GraphicsWdtextbox;
private RichTextBox GraphicsHttextbox;
private roRichTextBox GraphicsFiletextbox;
private roRichTextBox GraphicsWdtextbox;
private roRichTextBox GraphicsHttextbox;
private System.Windows.Forms.Button btnFindFile;
private string GraphicsText;
private ToolTip zmtooltip;
@@ -328,8 +328,8 @@ namespace ctlXMLEditLib
public string GetParentHTId { get { return parenthtid; } }
public void SetParentHTId(string id) { this.parenthtid = id; }
}
private RichTextBox _TextBoxFocus; // RO Editor add symbols C2022 - 003
public RichTextBox TextBoxFocus
private roRichTextBox _TextBoxFocus; // RO Editor add symbols C2022 - 003
public roRichTextBox TextBoxFocus
{
get { return _TextBoxFocus; }
set
@@ -390,7 +390,7 @@ namespace ctlXMLEditLib
// set the required fields tag on those fields which are included in the passed
// in required fields list.
private void DoSet(RichTextBox hwnd, string msg) // RO Editor add symbols C2022 - 003
private void DoSet(roRichTextBox hwnd, string msg) // RO Editor add symbols C2022 - 003
{
if (hwnd == null) return;
if (hwnd.Tag != null)
@@ -405,7 +405,7 @@ namespace ctlXMLEditLib
private void SetRequiredFields(ArrayList reqfields)
{
Object o;
RichTextBox hwnd;
roRichTextBox hwnd;
string field, msg;
int indx;
foreach (string strfld in reqfields)
@@ -424,15 +424,15 @@ namespace ctlXMLEditLib
o = myHT[field+"a"];
if (o != null) // set all combo types required, the checker
{
DoSet((RichTextBox)o,msg);
DoSet((RichTextBox)myHT[field+"b"],msg);
DoSet((RichTextBox)myHT[field+"c"],msg);
DoSet((RichTextBox)myHT[field+"d"],msg);
DoSet((roRichTextBox)o,msg);
DoSet((roRichTextBox)myHT[field+"b"],msg);
DoSet((roRichTextBox)myHT[field+"c"],msg);
DoSet((roRichTextBox)myHT[field+"d"],msg);
}
}
else if (o != null)
{
hwnd = (RichTextBox) o;
hwnd = (roRichTextBox) o;
if (hwnd.Tag != null)
{
TextBoxAttrTag tag = (TextBoxAttrTag) hwnd.Tag;
@@ -446,7 +446,7 @@ namespace ctlXMLEditLib
// C2021-026 If this is a Parent/Child field that has no value saved in the database
// then use the parent's value and display it as grey colored text.
private void GetDefaultParentValue(RichTextBox tb, XmlNode node, string chldName)
private void GetDefaultParentValue(roRichTextBox tb, XmlNode node, string chldName)
{
XmlNode parentNode = null;
// PCChildren contains a list strings reprenting the Children setup in the current Working Draft Parent/Child property
@@ -490,13 +490,13 @@ namespace ctlXMLEditLib
private void DisplayFieldContents(XmlNode node)
{
Object o;
RichTextBox hwnd;
roRichTextBox hwnd;
XmlNode nd;
// if we have an image, check it for validity, i.e. file exists, etc.??
foreach (string str in myHT.Keys)
{
o = myHT[str];
hwnd = (RichTextBox)o;
hwnd = (roRichTextBox)o;
nd = node.SelectSingleNode(str);
// if not found with just the string, search the tree.
if (nd==null)nd = node.SelectSingleNode("*/"+str);
@@ -575,7 +575,7 @@ namespace ctlXMLEditLib
// height/width data of the image.
if (GraphicsFiletextbox != null && GraphicsFiletextbox.Text != "") UpdateHtWd();
}
public RichTextBox GetGraphicsFiletextbox()
public roRichTextBox GetGraphicsFiletextbox()
{
return GraphicsFiletextbox;
}
@@ -614,13 +614,13 @@ namespace ctlXMLEditLib
{
dosaveflag=false;
mysavexml=false;
RichTextBox hwnd;
roRichTextBox hwnd;
// first, clear out all of the text boxes.
foreach (string str in myHT.Keys)
{
object o = myHT[str];
hwnd = (RichTextBox) o;
hwnd = (roRichTextBox) o;
hwnd.Text = "";
TextBoxAttrTag tag = (TextBoxAttrTag) hwnd.Tag;
RadioButton radio;
@@ -652,7 +652,7 @@ namespace ctlXMLEditLib
// to the parent's value, then clear the child's textbox so that nothing is saved
// to the database. This allow us to know that a specific value was not set
// for this Parent/Child child
private void RemovePCChildTextIfSameAsParent(XmlNode node, RichTextBox tb, string chldName)
private void RemovePCChildTextIfSameAsParent(XmlNode node, roRichTextBox tb, string chldName)
{
XmlNode parentNode = null;
// if this is a child node get the parent's value
@@ -696,7 +696,7 @@ namespace ctlXMLEditLib
{
if (mysavexml)
{
RichTextBox hwnd;
roRichTextBox hwnd;
TextBoxAttrTag tag;
string imgdate;
@@ -704,7 +704,7 @@ namespace ctlXMLEditLib
foreach (string str in myHT.Keys) // RO Editor add symbols C2022 - 003
{
object o = myHT[str];
hwnd = (RichTextBox) o;
hwnd = (roRichTextBox) o;
StringBuilder result1 = new StringBuilder();
char[] chrAry = hwnd.Text.ToCharArray();
@@ -908,7 +908,7 @@ namespace ctlXMLEditLib
// 'normalizedString') or a multiline text box(type is 'string'). Also, a radio
// button is passed in if this was called to handle an element within a combo type.
// This button is saved for a given text box so that initialization of these combo types can occur.
private string DisplayXmlSchemaSimpleType(XmlSchemaSimpleType simpleType, RichTextBox mytextbox, RadioButton radio,
private string DisplayXmlSchemaSimpleType(XmlSchemaSimpleType simpleType, roRichTextBox mytextbox, RadioButton radio,
bool img, string imgname)
{
// set up for text box tag, which stores whether field is required and
@@ -1050,7 +1050,7 @@ namespace ctlXMLEditLib
radio.CheckedChanged += new System.EventHandler(this.radiocheckchg);
gbox.Controls.Add(radio);
RichTextBox tb = new RichTextBox();
roRichTextBox tb = new roRichTextBox();
Size size3 = tb.Size;
tb.Location = new Point(boxx+20, y+25);
if (!first) tb.Visible = false;
@@ -1203,8 +1203,8 @@ namespace ctlXMLEditLib
}
else
{
RichTextBox mytextbox;
mytextbox = new RichTextBox();
roRichTextBox mytextbox;
mytextbox = new roRichTextBox();
Size size3 = mytextbox.Size;
mytextbox.Location = new Point(screenx+indent, screeny);
string tFieldName = (pcChildIdx == 0) ? CvtUserFldToFld(element.Name) : CvtUserFldToFld(pcChildFldName);
@@ -1333,7 +1333,7 @@ namespace ctlXMLEditLib
private void radiocheckchg(object sender, System.EventArgs e)
{
RadioButton btnsel = (RadioButton) sender;
RichTextBox assocbox;
roRichTextBox assocbox;
string btntext, str;
if(dosaveflag)mysavexml = true;
@@ -1346,7 +1346,7 @@ namespace ctlXMLEditLib
str = btnsel.Name.Replace(btntext,"");
object o = myHT[str];
if (o == null) return;
assocbox = (RichTextBox) o;
assocbox = (roRichTextBox) o;
// make the text box visible if checked, otherwise, invisible
assocbox.Visible = btnsel.Checked;
// C2021-026 show or hide the Parent/Child appicability group box
@@ -1460,7 +1460,7 @@ namespace ctlXMLEditLib
// The following can be used to validate the text, i.e. check the text against
// the pattern. this needs written yet (5/16/02)
private void MyValidatingCode(RichTextBox tb)
private void MyValidatingCode(roRichTextBox tb)
{
//get the text box's tag which contains a flag for whether this is required &
//if it has a pattern. If it has a pattern, validate the field against the pattern.
@@ -1491,7 +1491,7 @@ namespace ctlXMLEditLib
// save which box we're on, for zoom processing.
private void currentTextBox(object sender, System.EventArgs e)
{
RichTextBox textbox = (RichTextBox) sender;
roRichTextBox textbox = (roRichTextBox) sender;
if (textbox.Multiline == true || textbox == GraphicsFiletextbox)
zoomtextbox = textbox;
else
@@ -1517,7 +1517,7 @@ namespace ctlXMLEditLib
{
try
{
MyValidatingCode((RichTextBox) sender);
MyValidatingCode((roRichTextBox) sender);
}
catch(Exception ex)
@@ -2028,18 +2028,19 @@ namespace ctlXMLEditLib
set { _DisplaySymBolBtn = value; }
}
}
public static class RichTextBoxExtensions // RO Editor add symbols C2022 - 003
{
public static void InsertSymbol(this RichTextBox richTextBox, int symbcode)
{
int position = richTextBox.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 ";
richTextBox.SelectedRtf = RtfPrefixForSymbols + sym + @"}";
richTextBox.SelectedRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\uc1 }";
richTextBox.Select(position, 0);
}
}
//public static class RichTextBoxExtensions // RO Editor add symbols C2022 - 003
//{
// public static void InsertSymbol(this RichTextBox richTextBox, int symbcode)
// {
// int position = richTextBox.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 ";
// richTextBox.SelectedRtf = RtfPrefixForSymbols + sym + @"}";
// richTextBox.SelectedRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\uc1 }";
// richTextBox.Select(position, 0);
// }
//}
//roRichTextBox.InsertSymbol();
public enum E_FontStyle : byte

View File

@@ -137,6 +137,12 @@
<Compile Include="ImageDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="roRichTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="roRichTextBox.Designer.cs">
<DependentUpon>roRichTextBox.cs</DependentUpon>
</Compile>
<Compile Include="ZoomDialog.cs">
<SubType>Form</SubType>
</Compile>

View File

@@ -0,0 +1,40 @@

namespace ctlXMLEditLib
{
partial class roRichTextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
System.Windows.Forms.AutoScaleMode AutoScaleMode;
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

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);
}
}
}