//RichText添加选区 颜色
private void ChangeColor(string text, Color color)
{
//int s = 0;
//while ((-1 + text.Length - 1) != (s = text.Length - 1 + this.txtResult.Find(text, s, -1, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord)))
//{
// this.txtResult.SelectionColor = color;
//}
int s = 0;
//并上 RichTextBoxFinds.WholeWord 就没结果
while (this.txtResult.Find(text, s, RichTextBoxFinds.MatchCase) > -1)
{
s
= this.txtResult.Find(text, s, RichTextBoxFinds.MatchCase);
this.txtResult.Select(s, text.Length);
this.txtResult.SelectionColor = color;
s
++;
}

}

相关文章:

  • 2021-11-07
  • 2022-01-18
  • 2021-06-04
  • 2022-02-09
  • 2021-12-24
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案