C# code //找到指定的字符串,其实位置 int index = this.re.Find("bds"); if (index != -1) { //找到,则通过Select函数将当前光标调整到该位置 this.re.Select(index,0); //re.SelectionColor = Color.Red; //滚动到当前光标 this.re.ScrollToCaret(); int line = re.GetLineFromCharIndex(index); re.Select(re.GetFirstCharIndexFromLine(line),re.Lines[line].Length);
//找到指定的字符串,其实位置
int index = this.re.Find("bds");
if (index != -1)
{
//找到,则通过Select函数将当前光标调整到该位置
this.re.Select(index,0);
//re.SelectionColor = Color.Red;
//滚动到当前光标
this.re.ScrollToCaret();
int line = re.GetLineFromCharIndex(index);
re.Select(re.GetFirstCharIndexFromLine(line),re.Lines[line].Length);
re.SelectionBackColor = Color.Yellow;
}