I want to Get the DataGridView Header Cell's Background color, I have done a trick but its giving me empty and RGB = 0,0,0
I have try this code:
Color cl = dataGridView1.Columns["<Column>"].HeaderCell.Style.BackColor; //<AnyColumn>
I have to repaint Header Cell's Background of the same color as it has before repainting with size modifications .
Kindly Suggest a Solution, I have searched a lot but no useful help
The DataGridView uses style inheritance, so unless an individual header cell differs from the default, its BackColor will be set to Color.Empty.
Try the ColumnHeadersDefaultCellStyle.BackColor property instead.
Note that when EnableHeadersVisualStyles is set to true (the default), the value will be ignored and the headers will be drawn using a visual style renderer instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With