Using Bold font for setting a Datagrid forecolor
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 mak开发者_如何学Ce it bold?
Thanks, pooja
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;
Something like
dataGridView1.Font = new Font("Arial",8.5F , FontStyle.Bold);
i think this post answers your question:
How to make row in gridview bold and regular programatically
cheers:)
精彩评论