Solved

Changing color of data grid column headers only

Posted on 2011-03-08
5
344 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 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Error 11 58
Graphics 2 30
Call Controller Action Method from ASPX 2 16
VB.NET 2008 Winforms Signing 13 20
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!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

832 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