实现效果:

知识运用:
RichTextBox控件的Select方法
public void Select (int start, int length )
SelectionColor属性
public Color SelectionColor { get; set; }
实现代码:
private void Form1_Load(object sender, EventArgs e)
{
this.richTextBox1.Select(0,3);
this.richTextBox1.SelectionColor = Color.Red;
this.richTextBox1.Select(3,3);
this.richTextBox1.SelectionColor = Color.Green;
this.richTextBox1.Select(6,3);
this.richTextBox1.SelectionColor = Color.Blue;
this.richTextBox1.Select(9,3);
this.richTextBox1.SelectionColor = Color.Brown;
}
浙公网安备 33010602011771号