DataGridView.SetSelectedColumnCore(Int32, Boolean) 方法

定义

更改具有指定索引的列的选择状态。Changes the selection state of the column with the specified index.

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

参数

columnIndex
Int32

该列的索引。The index of the column.

selected
Boolean

如果选择该列,则为 true;如果取消选择该列,则为 falsetrue to select the column; false to cancel the selection of the column.

异常

columnIndex 小于 0 或大于控件中的列数减 1。columnIndex is less than 0 or greater than the number of columns in the control minus 1.

注解

@No__t-0 控件在更改列的选择状态时使用此方法。The DataGridView control uses this method whenever it changes the selection state of a column. 选择状态更改,而不考虑当前 SelectionMode 属性值,也不更改 @no__t 属性值。The selection state changes without regard to the current SelectionMode property value, and without changing the CurrentCell property value. 当您想要实现自己的选择模式时,这非常有用。This is useful when you want to implement your own selection modes.

适用于

另请参阅