Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to change Font property of Gridview form Windows form Application.
Posted
Updated 10-Sep-12 17:58pm
v2

See this MSDN article which explains it:
http://msdn.microsoft.com/en-us/library/z2akwyy7%28v=vs.80%29.aspx[^]
 
Share this answer
 
Just use DataGridView.Font Property[^] to change the font of
DataGridView.<br />
Try this:
C#
this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 15);



--Amit
 
Share this answer
 
C#
  YourGridname.ColumnHeadersDefaultCellStyle.Font =
       new Font(YourGridname.Font, FontStyle.Bold);

YourGridname.Columns[index].DefaultCellStyle.Font =
       new Font(YourGridname.DefaultCellStyle.Font, FontStyle.Italic);


also you can style columns, headers and cells go through below link
http://msdn.microsoft.com/en-us/library/1yef90x0.aspx[^]
 
Share this answer
 
There are three places to set font according to requirement/choice in DataGridView for WinForms. All these can be accessible via Properties window at Design time as well as we can set their properties at run time.

ColumnHeaderDefaultCellStyle: For changing Font related properties of Grid Column Headers.
dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Georgia", 12);

RowHeaderDefaultCellStyle: For changing Font related properties of Grid Row Headers.
dataGridView1.RowHeadersDefaultCellStyle.Font = new Font("Georgia", 10);


DefaultCellStyle: For changing Font related properties of Cells in the Grid.
dataGridView1.DefaultCellStyle.Font = new Font("Georgia", 9);



In properties window, you can find these options to on the selection of DataGridView control on form.

Good Luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900