C # WinForm cancels the default selected cell of DataGridView to make it not anti-blue
Http://www.cnblogs.com/freeliver54/archive/2009/02/16/1391325.html
Datagridview1.rows[0]. Selected = false;
In the form's constructor, it doesn't look like it's going to work. First column or anti-blue
Later try to put in the form of load finally see no anti-blue
also pay attention to the DataGridView1 tabindex (you can manually modify the Tablindex attribute value of F4 dataGridView1)
if it is a separate form form, add the following method directly in the Load method:Private voidDatagridview1_load (Objectsender, EventArgs e) {dataGridView1. rows[0]. Selected =false;//uncheckor dataGridView1. ClearSelection ();//uncheckif the form forms in the parent form, the subform Form1, the parent form MainForm method One: Add DataGridView databindingcomplete Events in the Form1 formPrivate voidDgrdin_databindingcomplete (Objectsender, Datagridviewbindingcompleteeventargs e) { if(Dgrdin.currentrow! =NULL) { This. dgrdIn.CurrentRow.Selected =false; } }
View Code
WinForm Cancel DataGridView First Row check state