如何以编程方式更改datagridview的选定单元格字体颜色 [英] How do I programmatically change the selected cell font color of datagridview

查看:91
本文介绍了如何以编程方式更改datagridview的选定单元格字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候。



我的问题是我想要更改datagridview中单元格的字体颜色,而不是整行,我想以编程方式进行,任何可能有帮助的建议?



谢谢。

解决方案

参考:如何将DataGridView单元格的字体设为特定颜色? [ ^ ]


dataGridView1.RowsDefaultCellStyle.BackColor = Color.Red;


On RowDataBound(object sender,GridViewRowEventArgs e)事件使用代码



e.Row.Cells [9] .BackColor = System.Drawing.Color.Orange;



和For Font颜色



e.Row.Cells [9] .ForeColor = Syste m.Drawing.Color.Black;

Greetings.

My problem is I want to change the font color of the cell in the datagridview, not the entire row, and I want to do it programmatically, any suggestions that might help ?

Thanks.

解决方案

Refer: How can I make a DataGridView cell's font a particular color?[^]


dataGridView1.RowsDefaultCellStyle.BackColor = Color.Red;


On RowDataBound(object sender, GridViewRowEventArgs e) event use code

e.Row.Cells[9].BackColor =System.Drawing.Color.Orange;

and For Font color

e.Row.Cells[9].ForeColor = System.Drawing.Color.Black;


这篇关于如何以编程方式更改datagridview的选定单元格字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆