DataGridViewColumnHeader Make Bold

I have one DataGridViewand want the title text in bold. I tried changing ColumnHeaderDefaultCellStyleto
DataGridViewCellStyle { BackColor=Color [Control], SelectionBackColor=Color [Highlight], SelectionForeColor=Color [HighlightText], Font=[Font: Name=Tahoma, Size=9.75, Units=3, GdiCharSet=0, GdiVerticalFont=False], WrapMode=True, Alignment=MiddleCenter }

In the designer, I see the Headers as Bold, but at runtime it shows as usual. Please do not forget that apart from ColumnHeaderDefaultCellStyleme, I also change DefaultCellStyle DataGridView, as well as individual columns.

How to make headlines bold?

+5
source share
3 answers

Suppose you want to change the style of a 0DataGridView column myDataGrid:

myDataGrid.Columns[0].HeaderCell.Style.Font = new Font("Tahoma", 9.75F, FontStyle.Bold);

If you want to change the default value for the headers:

myDataGrid.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9.75F, FontStyle.Bold);

EDIT:

, ColumnHeadersDefaultCellStyle, Font Bold=True:

+22

:

dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold);
+7

@Shaahin. dataGridView1.ColumnHeadersDefaultCellStyle.Font DataGridView.DefaultFont datagridview, , , datagridview, DataGridView.DefaultFont. DataGridView.DefaultFont dataGridView1.ColumnHeadersDefaultCellStyle.Font

dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font(dataGridView1.ColumnHeadersDefaultCellStyle.Font, FontStyle.Bold);

vb # . , , .

0

All Articles