Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinForms DataGridView font size

How do I change font size on the DataGridView?

like image 793
leora Avatar asked Sep 15 '08 15:09

leora


People also ask

How to change DataGridView font size in c#?

In winform datagrid, right click to view its properties. It has a property called DefaultCellStyle. Click the ellipsis on DefaultCellStyle, then it will present Cell Style Builder window which has the option to change the font size.

Which property is used in Windows desktop application form to set font color?

DefaultCellStyle property to set the font for the entire control.


2 Answers

In winform datagrid, right click to view its properties. It has a property called DefaultCellStyle. Click the ellipsis on DefaultCellStyle, then it will present Cell Style Builder window which has the option to change the font size.

Its easy.

like image 104
Merin Nakarmi Avatar answered Oct 04 '22 10:10

Merin Nakarmi


    private void UpdateFont()     {         //Change cell font         foreach(DataGridViewColumn c in dgAssets.Columns)         {             c.DefaultCellStyle.Font = new Font("Arial", 8.5F, GraphicsUnit.Pixel);         }     } 
like image 35
psamwel Avatar answered Oct 04 '22 10:10

psamwel