?
Solved

Changing color of data grid column headers only

Posted on 2011-03-08
5
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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!
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

765 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