标签:红色 winform string ring 选择 int tar info richtext
private void HilightRichText(RichTextBox control, string hilightString)
{
int nSelectStart = control.SelectionStart;
int nSelectLength = control.SelectionLength;
int nIndex = 0;
while (nIndex < control.Text.Length)
{
nIndex = control.Find(hilightString, nIndex, RichTextBoxFinds.WholeWord); //整个文档查找
if (nIndex < 0)
{
break;
}
control.Select(nIndex, hilightString.Length); //选择文本
control.SelectionColor = Color.Red;
nIndex += hilightString.Length;
}
control.Select(nSelectStart, nSelectLength);
}
标签:红色 winform string ring 选择 int tar info richtext
原文地址:http://www.cnblogs.com/c-cccc/p/6189162.html