DataGridViewCellStyle.Font Property

 

Gets or sets the font applied to the textual content of a DataGridView cell.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member Font : Font with get, set

Property Value

Type: System.Drawing.Font

The Font applied to the cell text. The default is null.

You can use this property to change the typeface styles applied to the cell text. Because a Font is immutable (its properties are read-only), you can modify this property only by assigning a new or existing Font to it; you cannot alter the properties of the returned object directly.

The following code example sets the font for column headers. To run this example, paste the code into a form that contains a DataGridView named GridView1, and then call the SetupUpDataGridView and PopulateDataGridView methods from the form's constructor or OnLoad method. Ensure all events are associated with their event-handling methods.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: