DataGridView.SetSelectedCellCore(Int32, Int32, Boolean) 方法

定义

更改具有指定的行索引和列索引的单元格的选择状态。

protected:
 virtual void SetSelectedCellCore(int columnIndex, int rowIndex, bool selected);
protected virtual void SetSelectedCellCore (int columnIndex, int rowIndex, bool selected);
abstract member SetSelectedCellCore : int * int * bool -> unit
override this.SetSelectedCellCore : int * int * bool -> unit
Protected Overridable Sub SetSelectedCellCore (columnIndex As Integer, rowIndex As Integer, selected As Boolean)

参数

columnIndex
Int32

包含单元格的列的索引。

rowIndex
Int32

包含该单元格的行的索引。

selected
Boolean

如果选择该单元格,则为 true;如果取消选择该单元格,则为 false

例外

columnIndex 小于 0 或大于控件中的列数减 1。

- 或 -

rowIndex 小于 0 或大于控件中的行数减 1。

注解

控件 DataGridView 在更改单元格的选择状态时使用此方法。 选择状态会更改,而不考虑当前 SelectionMode 属性值,也不更改 CurrentCell 属性值。 如果要实现自己的选择模式,这非常有用。

适用于

另请参阅