我爱Aspx >> Asp.Net >> dataGridView 控件的cell 的style 属性怎么不管用??现有dataGridView 控件d1.
google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";
我想把第二行第二个cell的背景色置成红色,
d1.Rows[1].Cells[1].Style.BackColor=Color.red ;
这一句编译倒是没问题, 但是无效.
DataGridViewCellStyle cs = new DataGridViewCellStyle();
cs.BackColor = Color.Red;
d1.Rows[1].Cells[1].Style = cs;
编译也可以通过, 同样无效.
唯一的办法是在CellFormatting [或Painting] 事件里处理, 怎么会这样?
为什么前面两种方法会无效?
第2楼. 由 Moosdau 于 2007-6-25 10:15:19 发表
没人理我...
第3楼. 由 tianzhenjing 于 2007-6-25 23:11:22 发表
看一下生成的html源码,有生成的代码吗?
第4楼. 由 Moosdau 于 2007-6-27 14:44:08 发表
已经知道答案, 第一句其实是可以的, 但是因为它不会即时刷新, 所以没看到效果, 在第一句后面加一句d1.refresh() , 就可以了~~
Ҷƪл˵?
4条件查询[07-06]
求Visual Studio 2005 extension..[07-06]
函数的参数为(out string aa)是..[07-06]
server(windows)/client(linux)通..[07-06]
struts+spring+hibernate - myec..[07-06]
jboss下ejb hellowold 部署,已经..[07-06]
菜鸟求解答!JSP中跳转问题[07-06]
如何获得client的MAC地址?[07-06]
为什么这个例子程序编译不过?[07-06]
为何Bean无法取值?[07-06]