DataGridView.SetSelectedRowCore(Int32, Boolean) 方法

定義

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

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

參數

rowIndex
Int32

資料列的索引。

selected
Boolean

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

例外狀況

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

備註

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

適用於

另請參閱