如何更改datagridview中所有单元格的背景色,原色和字体 [英] How to change the backcolor, forecolor and font of all cells in a datagridview
问题描述
我有10000行和250列的datagridview
I have a datagridview of 10000 rows and 250 columns
我更改任何特定单元格的颜色和字体,例如
i change the color and font of any specific cell like
dg.Item(1,1).Style.Font =新字体("Arial",25)
dg.Item(1,1).Style.ForeColor = Color.GreenYellow
dg.Item(1, 1).Style.Font = New Font("Arial", 25)
dg.Item(1, 1).Style.ForeColor = Color.GreenYellow
dg.Item(2,1).Style.Font =新字体("Arial",15)
dg.Item(2,1).Style.ForeColor = Color.Red
dg.Item(2, 1).Style.Font = New Font("Arial", 15)
dg.Item(2, 1).Style.ForeColor = Color.Red
在某个时间点
在form_clik中,我想将完整的单元格重置为我自己的颜色和字体
at form_clik I want to reset complete cells to my own color and font
有什么快速的方法可以做到这一点吗? (不访问所有单元格)
Is there any quick way to do this? (without going to all cells)
致谢
推荐答案
是的,设置datagridview的列
Yea set the column of the datagridview
有无穷的可能性
https://msdn.microsoft.com/zh-CN/library/system.windows.forms.datagridviewcolumn(v=vs.110).aspx
这篇关于如何更改datagridview中所有单元格的背景色,原色和字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!