DataGridView的這種奇怪的行爲讓我感到沮喪。ClearSelection後選擇Datagridview單元格
當其數據綁定時,即使網格沒有焦點,也會選擇一個單元格。我已經採取了一些變通這樣
this.ActiveControl = textBoxPartySearch;
dataGridView1.Refresh();
dataGridView1.ClearSelection();
dataGridView1.CurrentCell = null;
e.Handled = true;
在我的這個問題建議: Remove blue colored row from DataGridView WinForms
但是,這種解決方法有時不工作,使代碼混亂。
是否有任何其他免費的datagridview可用,沒有這個問題?
如果您在CellFormatting中存在與綁定時混淆的東西,則必須將其放在DataBindingComplete中。 –