Change look of DataGridView in C#

Asked By 10 points N/A Posted on -
qa-featured

Hi,

I am a new software developer, i am using C# to build programs, actually my problem is little bit complicated,

Actually i want to change the color of Column Header in DataGridView,

Here is the dataGridView,

I want to change the color of the column header of the DataGridView to blue.

is it possible to do that or not?

if yes then can anyone guide me how can i do that?

Thanks.

SHARE
Answered By 0 points N/A #117350

Change look of DataGridView in C#

qa-featured

Yes dear its possible to change header column back color and its really very simple.

There are two ways to change the header column color:

1. Graphically in designer (through properties window)

2. Programatically (through coding)

 

1…If you want to change it from designer window, then right click the dataGridView and goto "Properties"

here, click on "ColumnHeadersDefaultCellStyle", a button will appear there, click on it, now in new window click backcolor and select your desired color.

after doing this, in properties window click on "EnableHeadersVisualStyles" and set it to false.

2…If you want to do it programmatically, then add these two statements where you require to change column header back color:

            dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Blue;
            dataGridView1.EnableHeadersVisualStyles = false;

 

you are done!

Login/Register to Answer

Related Questions