我一直试图在我的文本框中为某些单词着色,例如" hi"," bye"
我尝过这样的话:
int stIndex = 0;
stIndex = richTextBox1.Find(wh, stIndex, RichTextBoxFinds.MatchCase);
while (stIndex != -1)
{
if (richTextBox1.SelectedText == wh)
{
richTextBox1.SelectionLength = wh.Length;
richTextBox1.SelectionColor = Color.Blue;
}
stIndex = richTextBox1.Find(wh, stIndex + 1, RichTextBoxFinds.MatchCase);
}
但选择单词因此移动光标有没有其他方法可以做到这一点?