您的位置:首页 > 其它

怎样在网页的code behind里动态改变控件的背景颜色

2010-07-13 00:04 513 查看
点击提交按钮后,想让文本框的背景变成浅灰色。搜索的结果:

this.txtUserName.BackColor = System.Drawing.Color.LightGray;

this.txtUserName.BackColor = System.Drawing.Color.FromArgb(0x336699);

this.txtUserName.BackColor =
System.Drawing.

Color.FromArgb(((System.Byte)(255)), ((System.Byte)(0)), ((System.Byte)(0)));

很简单,只要知道System.Drawing命名空间就可以了。

还有论坛上用这些方法,等有机会试一试:

bodytag.Attributes.Add("bgcolor", "#ff0099");
form1.Attributes.Add("style", "background-color:#FF5050;");
form1.Attributes.CssStyle.Add("BACKGROUND-COLOR", "#FF5050");



这幅图能看清颜色名称

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: