如何从 Windows 窗体 datagridview 中删除当前单元格焦点?我有一个包含一些 datagridforms 的对话框,最初我不想选择单元格。实际上在每个网格视图中都选择了单元格 [1,1]
我已经在一些论坛中搜索过,但提供的解决方案不起作用。例如,通常建议设置 CurrentCell = null --> 但这没有效果。有没有其他解决方案,它确实有效;-)?
我认为这会起作用:
if (dataGridView.RowCount > 0 && dataGridView.ColumnCount >0)
{
dataGridView.CurrentCell = this.dataGridView[0, 0];
this.dataGridView.CurrentCell.Selected = false;
}
Run Code Online (Sandbox Code Playgroud)
dataGridView.ClearSelection();
dataGridView.CurrentCell = null;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9248 次 |
| 最近记录: |