How to Change the Appearance of a Single Header Cell in Windows Forms GridDataBoundGrid(Classic)
9 Dec 2019 / 1 minute to read
To make changes to individual cells (header cells or otherwise), you must implement PrepareViewStyleInfo event.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex == 2 && e.RowIndex == 0)
{
//Changes Font style, Font size, orientation, Text color of column header 3.
e.Style.Font.Italic = true;
e.Style.Font.Bold = true;
e.Style.Font.Orientation = 270;
e.Style.TextColor = Color.Red;
}
}
Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
If e.ColIndex = 2 And e.RowIndex = 0 Then
'Changes Font style, Font size, orientation, Text color of column header 3.
e.Style.Font.Italic = True
e.Style.Font.Bold = True
e.Style.Font.Orientation = 270
e.Style.TextColor = Color.Red
End If
End Sub
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page