winform下richtextbox 特定字符颜色的改变
此程序特定字符为"(*)"
private void richtextbox _TextChanged(object
sender, EventArgs e)
{
string[] str = richtextbox .Text.Split(new string[] { "(*)" },
StringSplitOptions.RemoveEmptyEntries);
int p2=0;
for (int i = 0; i < str.Length;i++ )
{
int p1 = Alisturl.Text.IndexOf("(*)",p2);
if (p1 != -1)
{
richtextbox.Select(p1, 3);
richtextbox.SelectionColor = Color.DarkGreen;
p2 = p1 + 3;
}
}
richtextbox.Refresh();
}