How do I stop FullRowSelect from also selecting a column header

Viewed 625

I looked on other posts about DataGridView SelectionMode but I did not find anyone with the same problem.

Only happens on .NET 4.7.2

When I select a row, the header for the column I clicked also gets selected, like this:

Selected header

1 Answers

Add the following two lines of code to your constructor (the first line can also be set in the designer):

GridContatos.EnableHeadersVisualStyles = false;
GridContatos.ColumnHeadersDefaultCellStyle.SelectionBackColor = GridContatos.ColumnHeadersDefaultCellStyle.BackColor;
Related