0
我有Rich
文本框和它的命名textBox1
豐富的文本框Color.Red不存在
當我試試這個:
textBox1.AppendText(value);
textBox1.SelectionColor = Color.Red;
的Red
有下劃線且出錯:
Error 2 'string' does not contain a definition for 'Red' and no extension method 'Red' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) Form1.cs 73 57
確保您使用的顏色對象正確的命名空間。 – Tariqulazam
你的表單是否有名爲'Color'的字段或屬性?如果是這樣,您需要通過指定'System.Drawing.Color.Red'來消除歧義。 –
@Michael Liu,發貼爲答案 – Andrew