• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

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?
  • 2
  • 2
1 Solution
Anil GolamariCommented:
we can change the color of the header in code by using

grid1.HeaderStyle.BackColor = Color.Yellow
LenTompkinsAuthor Commented:
I forgot to tell you that this is a windows form and there is no Heade rStyle property for the grid.
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

LenTompkinsAuthor Commented:
Perfect Thank you very much.
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.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now