?
Solved

Changing color of data grid column headers only

Posted on 2011-03-08
5
Medium Priority
?
360 Views
Last Modified: 2012-06-21
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?
0
Comment
Question by:LenTompkins
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35069692
we can change the color of the header in code by using

grid1.HeaderStyle.BackColor = Color.Yellow
0
 

Author Comment

by:LenTompkins
ID: 35070511
I forgot to tell you that this is a windows form and there is no Heade rStyle property for the grid.
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35072956
0
 
LVL 6

Accepted Solution

by:
nandithaa earned 2000 total points
ID: 35079858
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
 

Author Closing Comment

by:LenTompkins
ID: 35083940
Perfect Thank you very much.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question