2
votes

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
I couldn't reproduce this. Give more details about how this DataGdidView is set up. You can find it in the FormName.Designer.cs file unless you also did stuff yourself manually in the FormName.cs file - Caius Jard

1 Answers

1
votes

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;