如何制作datagridview Headers FONT BOLD? [英] How to make datagridview Headers FONT BOLD?

查看:93
本文介绍了如何制作datagridview Headers FONT BOLD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作datagridview标题FONT BOLD?

解决方案

你昨天问了同样的问题!我昨天回答了这个问题;



为datagridview设置 ColumnHeadersDefaultCellStyle 属性。



你不明白哪个部分,你甚至看过 DataGridView ColumnHeadersDefaultCellStlye



您可以在设计时通过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 the ColumnHeadersDefaultCellStyle property for the datagridview.

What part do you not understand, did you even look at the documentation for DataGridView, or ColumnHeadersDefaultCellStlye?

You can set this property via the IDE at design time, or can apply the styling via code at run time. The ColumnHeadersDefaultCellStyle uses a DataGridViewStyle object, of which it has a Font property, which itself has a Bold property which can have the FontStyle.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屋!

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