C# RichTextBox设置不同颜色

    xiaoxiao2022-06-30  97

               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;             }


    最新回复(0)