Articles in this section
Category / Section

How to change the color of all headers in WinForms GridDataBoundGrid?

1 min read

 

BaseStyles control the header colors. To color all headers a particular color, you have to pass the Header in the BaseStyleMap. To color Row Header, you have to pass the Row Header in the BaseStyleMap. To color Column Header, you have to pass the Column Header in the BaseStyleMap

C#

//Change the appearance of headers

this.gridDataBoundGrid1.BaseStylesMap["Header"].StyleInfo.BackColor = Color.Blue;

//Change the appearance of Row Header

this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.BackColor = Color.Red;

//Change the appearance of Column Header

this.gridDataBoundGrid1.BaseStylesMap["Column Header"].StyleInfo.BackColor = Color.White;

VB

'Change the appearance of headers

Me.GridDataBoundGrid1.BaseStylesMap("Header").StyleInfo.BackColor = Color.Blue

'Change the appearance of Row Header

Me.GridDataBoundGrid1.BaseStylesMap("Column Header").StyleInfo.BackColor = Color.White

'Change the appearance of Column Header

Me.GridDataBoundGrid1.BaseStylesMap("Row Header").StyleInfo.BackColor = Color.Red


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied