在窗体的中点击button1,然后在richtextbox中的“百度”两个文字会变成选中状态,就像记事本中的查找功能一样,当你查找到“百度”这两个字后,“百度”两个字变成蓝色的。
怎么实现? 

解决方案 »

  1.   

    SelectionStart = index;
    SelectionLength = length;
    SelectionBackColor =Color.Blue;
    SelectionColor = Color.White
    自己研究出来了
      

  2.   

    richTextBox1.Text = "把百度找出来";
                string str = "百度";            int idx = richTextBox1.Text.IndexOf(str);
                richTextBox1.Select(idx, str.Length);
                richTextBox1.SelectionColor = Color.Blue;