Changing color of data grid column headers only

users would like to have all column headers only be in a color, but the values of each row be in white.
I have changed the Column Header Default Cell Style back color to yellow, and the default cell style back color to yellow as well and the header doesn't change color.  Does anyone have any suggestions?
LenTompkinsAsked:
Who is Participating?
 
nandithaaConnect With a Mentor Commented:
Column header color cannot be changed unless you set the "EnableHeadersVisualStyles " property of datagrid to "False".

Try this:
dataGridView1.EnableHeadersVisualStyles = false;
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Yellow;

Open in new window

0
 
Anil GolamariCommented:
we can change the color of the header in code by using

grid1.HeaderStyle.BackColor = Color.Yellow
0
 
LenTompkinsAuthor Commented:
I forgot to tell you that this is a windows form and there is no Heade rStyle property for the grid.
0
 
LenTompkinsAuthor Commented:
Perfect Thank you very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.