如何制作datagridview Headers FONT BOLD? [英] How to make datagridview Headers FONT BOLD?
本文介绍了如何制作datagridview Headers FONT BOLD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何制作datagridview标题FONT BOLD?
解决方案
你昨天问了同样的问题!我昨天回答了这个问题;
为datagridview设置ColumnHeadersDefaultCellStyle
属性。
你不明白哪个部分,你甚至看过DataGridView
或ColumnHeadersDefaultCellStlye $的文档c $ c>?
您可以在设计时通过IDE设置此属性,也可以在运行时通过代码应用样式。ColumnHeadersDefaultCellStyle
使用DataGridViewStyle
对象,其中有一个Font
property,它本身有一个Bold
属性,可以应用FontStyle.Bold
。
您可以使用以下代码使datagridview标题字体加粗。
使用dataGridView1 .ColumnHeadersDefaultCellStyle
.BackColor = Color.Navy
.ForeColor = Color.White
.Font = New Font(dataGridView1.Font,FontStyle.Bold)
End With
希望这会有所帮助!
在vb.net中的
Dim dc As DataGridViewColumn = DataGridView1.Columns( i)
dc.HeaderCell.Style.BackColor = Color.FromArgb( 196 , 196 , 196 )
dc.HeaderCell.Style.ForeColor = Color.FromArgb( 0 , 0 , 0 )
dc.HeaderCell.Style.Font = 新字体( Arial, 12 ,FontStyle.Bold)
How to make datagridview Headers FONT BOLD?
解决方案
You asked the same question yesterday! I answered the question yesterday;
Set theColumnHeadersDefaultCellStyle
property for the datagridview.
What part do you not understand, did you even look at the documentation forDataGridView
, orColumnHeadersDefaultCellStlye
?
You can set this property via the IDE at design time, or can apply the styling via code at run time. TheColumnHeadersDefaultCellStyle
uses aDataGridViewStyle
object, of which it has aFont
property, which itself has aBold
property which can have theFontStyle.Bold
applied.
You can use following code to make datagridview headers font bold.
With dataGridView1.ColumnHeadersDefaultCellStyle .BackColor = Color.Navy .ForeColor = Color.White .Font = New Font(dataGridView1.Font, FontStyle.Bold) End With
Hope this will help!
in vb.net
Dim dc As DataGridViewColumn = DataGridView1.Columns(i) dc.HeaderCell.Style.BackColor = Color.FromArgb(196, 196, 196) dc.HeaderCell.Style.ForeColor = Color.FromArgb(0, 0, 0) dc.HeaderCell.Style.Font = New Font("Arial", 12,FontStyle.Bold )
这篇关于如何制作datagridview Headers FONT BOLD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文