this.richTextBox1.Text = "井:1;温度:3;湿度:4;花式设度:5;详细描述:照片";
string[] strArr = richTextBox1.Text.Split(';');
for (int i = 0; i < strArr.Length; i++)
{
string[] str;
int strleng = 0;
for (int j = 0; j < i; j++)
{
str = strArr[j].ToString().Split(':');
strleng += str[0].Length + str[1].Length + 2;
}
str = strArr[i].ToString().Split(':');
richTextBox1.Select(strleng, str[0].Length);
richTextBox1.SelectionColor = Color.Red;
}
C# RichTextBox设置不同颜色
最新推荐文章于 2025-03-10 10:05:34 发布