DataGridView.SetCurrentCellAddressCore 方法

定義

設定目前的現用儲存格。

protected:
 virtual bool SetCurrentCellAddressCore(int columnIndex, int rowIndex, bool setAnchorCellAddress, bool validateCurrentCell, bool throughMouseClick);
protected virtual bool SetCurrentCellAddressCore (int columnIndex, int rowIndex, bool setAnchorCellAddress, bool validateCurrentCell, bool throughMouseClick);
abstract member SetCurrentCellAddressCore : int * int * bool * bool * bool -> bool
override this.SetCurrentCellAddressCore : int * int * bool * bool * bool -> bool
Protected Overridable Function SetCurrentCellAddressCore (columnIndex As Integer, rowIndex As Integer, setAnchorCellAddress As Boolean, validateCurrentCell As Boolean, throughMouseClick As Boolean) As Boolean

參數

columnIndex
Int32

包含儲存格的資料行之索引。

rowIndex
Int32

包含儲存格的資料列之索引。

setAnchorCellAddress
Boolean

true 表示讓新的目前儲存格變成後續使用 SHIFT 鍵之多儲存格選取範圍的錨定 (Anchor) 儲存格;否則為 false

validateCurrentCell
Boolean

true 表示驗證目前的舊儲存格中的值,並在驗證失敗時取消變更;否則為 false

throughMouseClick
Boolean

如果目前的儲存格是設為按一下滑鼠的結果,則為 true;否則為 false

傳回

Boolean

如果目前的儲存格已設定成功,則為 true;否則為 false

例外狀況

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

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

指定的儲存格具有 Visiblefalse屬性值。

-或- 基於重設基礎資料來源以外的原因而呼叫這個方法,且另一個執行緒目前正在執行此方法。

新的目前儲存格嘗試進入編輯模式,但其 EditType 屬性未指出衍生自 Control 並實作 IDataGridViewEditingControl 的類別。

備註

控制項 DataGridView 會在變更目前儲存格時使用這個方法。 這個方法會變更目前的儲存格,而不需變更選取範圍,也可以選擇性地驗證上一個儲存格或變更選取錨點儲存格。 錨點儲存格是多個儲存格區塊的第一個儲存格,使用者可以按住 SHIFT 鍵並按一下區塊的最後一個儲存格來選取。

如果 rowIndexcolumnIndex 都是 -1,則 屬性會 CurrentCellnull 回 。

適用於

另請參閱