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 屬性值。 當您想要實作自己的選取模式時,這會很有用。

適用於

另請參閱