您可以使用RichTextBox控件的SelectionColor属性来设置文本的颜色,并使用SelectionBackColor属性来设置文本的背景颜色。 以下是一个使用RichTextBox控件显示文本并支持单独的行着色的示例代码: 代码语言:csharp 复制 privatevoidSetLineColor(RichTextBoxrtb,intlineNumber,Colorcolor){intstartIndex=rtb.GetFirstCharIndexFr...
varcolor=_richTextBox.SelectionColor; _richTextBox.SelectionColor=logLevel==LogLevel.Error?Color.Red:Color.Black; _richTextBox.AppendText($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}-{logLevel.ToString().ToUpper()}-{message}{Environment.NewLine}"); _richTextBox.SelectionColor=color; _r...
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using ...
【RichTextBox 控件】 Windows 窗体 RichTextBox 控件用于显示、输入和操作格式化的文本。RichTextBox 控件除了做 TextBox 控件所做的每件事外,还可以显示字体、颜色和链接,从文件加载文本和加载嵌入的图像,以及查找指定的字符。RichTextBox 控件通常用于提供类似字处理应用程序(如 Microsoft Word)的文本操作和显示功能。
For your question, you could use RichTextBox to color specific letter.I use TextBox1 to input text "Ramya" and RichTextBox to input "Ranya". Please try the code below.prettyprint 複製 private string Intersect() { string t1 = richTextBox1.Text; string t2 = textBox1.Text; return ...
{ richTextBox1.Font = fontDialog1.Font; richTextBox1.ForeColor = fontDialog1.Color; } } private void button2_Click(object sender, EventArgs e) { printPreviewControl1.Document = printDocument1; //printPreviewDialog1.Document = printDocument1; //printPreviewDialog1.ShowDialog(); } private ...
this.richTextBox1=newSystem.Windows.Forms.RichTextBox(); //Associate the context menu this.toolStripMenuItem1.Text="New"; this.toolStripMenuItem2.Text="Copy"; this.toolStripMenuItem3.Text="Cut"; this.contextMenuStripEx.Items.AddRange(newSystem.Windows.Forms.ToolStripItem[]{this.toolStripMe...
By using theMore colors…option in the built-in color picker, end users can select a desired color. Exporting a new theme A new theme is exported in theme library format, which can be integrated in any user application to experience the control’s rich user interface. End users can export...
ComboBox TheWinForms ComboBoxcontrol allows the users to type a value or choose an item or multiple items from a list of predefined options. Any UI control can be loaded as the header at the top of the drop-down to perform customized actions like, search and filter. The rich feature set...
RichTextBox (Deprecated)/RichTextBoxSpellchecking Rotator/RotatorSlideShow Sample Applications Scheduler SpinEditor/CustomDisplayText SplashScreen TaskBoard/TaskBoardEditDialog Testing/JustMock ThemeLoader TreeView VideoPlayerSample VirtualGrid VirtualKeyboard ...