How to Change the Color of All Headers in WinForms GridControl
15 Jun 20211 minute to read
Introduction
The styles of the Header cells are controlled by base styles. The “Header” base style will affect all column headers including cell 0,0. The “Column Header” base style will affect the column headers excluding cell 0,0. The “RowHeader” base style will affect all row headers excluding cell 0,0.
//Column headers including cell 0,0.
this.grid.BaseStylesMap["Header"].StyleInfo.BackColor = Color.Blue;
//Column headers excluding cell 0,0.
this.grid.BaseStylesMap["Column Header"].StyleInfo.BackColor = Color.Red;
//Row headers excluding cell 0,0.
this.grid.BaseStylesMap["Row Header"].StyleInfo.BackColor = Color.Green;
'Column headers including cell 0,0.
Me.grid.BaseStylesMap("Header").StyleInfo.BackColor = Color.Blue
'Column headers excluding cell 0,0.
Me.grid.BaseStylesMap("Column Header").StyleInfo.BackColor = Color.Red
'Row headers excluding cell 0,0.
Me.grid.BaseStylesMap("Row Header").StyleInfo.BackColor = Color.Green