111,130
社区成员
发帖
与我相关
我的任务
分享private int FindNext(string text, bool bMatchCase, bool bReverse)
{
if (text == null) return -1;
this.richTextBox1.Focus();
RichTextBoxFinds findOptions = RichTextBoxFinds.None;
int start = this.richTextBox1.SelectionStart;
int end = start;
if (bReverse)
{
start = 0;
end = this.richTextBox1.SelectionStart;
findOptions |= RichTextBoxFinds.Reverse;
}
else
{
start += this.richTextBox1.SelectionLength;
end = this.richTextBox1.TextLength;
this.richTextBox1.SelectionStart = start;
}
this.richTextBox1.SelectionLength = 0;
if (bMatchCase)
{
findOptions |= RichTextBoxFinds.MatchCase;
}
return this.richTextBox1.Find(text, start, end, findOptions);
}搂主直接调用这个函数应该可以实现你的需求