小弟我想在 aspx.CS 后台中写:this.TextBox1.BackColor = "006030" 为什么报错, 可是在aspx

我想在 aspx.CS 后台中写:this.TextBox1.BackColor #006030 为什么报错, 可是在aspx 页中就正常啊我想

我想在 aspx.CS 后台中写:this.TextBox1.BackColor = "#006030"; 为什么报错, 可是在aspx 页中就正常啊


我想在   aspx.CS   后台中写:this.TextBox1.BackColor   =     "#006030 ";   为什么报错,   可是在aspx   页中就正常啊

[解决办法]
this.TextBox1.BackColor = System.Drawing.ColorTranslator.FromHtml( "#006030 ");需要一个Color对象
[解决办法]
using System.Drawing;
this.TextBox1.BackColor = ColorTranslator.FromHtml( "#006030 ");
[解决办法]
别忘了引用:System.Drawing