Using Bold font for setting a Datagrid forecolor

1.5k Views Asked by At

How do I make the font of a forecolor bold when I use this below code dg.ForeColor = System.Drawing.Color.Black; How do I make it bold?

Thanks, pooja

3

There are 3 best solutions below

0
On

Something like

dataGridView1.Font = new Font("Arial",8.5F , FontStyle.Bold);
0
On

i think this post answers your question:

How to make row in gridview bold and regular programatically

cheers:)

0
On

You can use this code (which you can also find in the designer.cs):

var dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle1;