DataGridView.SetSelectedColumnCore(Int32, Boolean) 方法

定義

變更具有指定索引的資料行之選取狀態。

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

資料行的索引。

selected
Boolean

true 表示選取資料行,false 則表示取消選取資料行。

例外狀況

columnIndex 小於 0,或大於控制項中的資料行數目減 1。

備註

DataGridView每當控制項變更資料行的選取狀態時,控制項就會使用這個方法。 選取狀態會變更,而不需考慮目前的 SelectionMode 屬性值,而且不會變更 CurrentCell 屬性值。 當您想要實作自己的選取模式時,這會很有用。

適用於

另請參閱