Is there a way to make a DataGridView have no cell selected? I notice even when it loses focus() it has a at least one active cell. Is there another mode that allows this? or some other trick?
DataGridView.CurrentCell property can be used to clear the focus rectangle.
You can set this property (DataGridView.CurrentCell) to null to temporarily remove the focus rectangle, but when the control receives focus and the value of this property is null, it is automatically set to the value of the FirstDisplayedCell property.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcell.aspx
The problem with setting the DataGridView.CurrentCell to null on the selection change event is that later events (like click) will not be hit.
The option that worked for me was to change the selection color to the grid color. The selection will therefore not be visible.
RowsDefaultCellStyle.SelectionBackColor = BackgroundColor;
RowsDefaultCellStyle.SelectionForeColor = ForeColor;
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