如何为 FCTB(快速彩色文本框)中的一个文本字着色

how to color one word of text in a FCTB (Fast Color Text Box)

我可以在 C# 中创建快速彩色文本框并轻松地向其中添加文本:

FastColoredTextBox tb = new FastColoredTextBox();
this.Controls.Add(tb);
tb.Location = new Point(10, 10);
tb.Visible = true;
tb.Text = "This is some text to display in the FCTB.";

我不明白如何将该文本的一个单词更改为不同的颜色。

我不想通过语法来识别单词,我的应用程序更像是一个文字处理器,用户希望用颜色来强调单词。

例如,如何将上面代码段中的单词 "some" 更改为绿色而不是黑色?

谢谢

我终于找到了我要找的成员函数。

这是操作方法。

  FastColoredTextBox tb = new FastColoredTextBox();
  this.Controls.Add(tb);
  tb.Location = new Point(0, 0);
  tb.Visible = true;
  tb.Text = "This is some text to display in the FCTB.";
  // define a new Style... specifically a TextStyle
  Style greenstyle = new TextStyle(Brushes.Green, Brushes.White, FontStyle.Bold);
  // select the range of characters to modify
  Range rng = new Range(tb, 8, 0, 12, 0);
  // change the display to green
  rng.SetStyle(greenstyle);