DataGridView.SetCurrentCellAddressCore 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定目前的現用儲存格。
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
。
傳回
如果目前的儲存格已設定成功,則為 true
;否則為 false
。
例外狀況
columnIndex
小於 0,或大於控制項中的資料行數目減 1,且 rowIndex
不是 -1。
-或-
rowIndex
小於 0,或大於控制項中的資料列數目減 1,且 columnIndex
不是 -1。
新的目前儲存格嘗試進入編輯模式,但其 EditType 屬性未指出衍生自 Control 並實作 IDataGridViewEditingControl 的類別。
備註
控制項 DataGridView 會在變更目前儲存格時使用這個方法。 這個方法會變更目前的儲存格,而不需變更選取範圍,也可以選擇性地驗證上一個儲存格或變更選取錨點儲存格。 錨點儲存格是多個儲存格區塊的第一個儲存格,使用者可以按住 SHIFT 鍵並按一下區塊的最後一個儲存格來選取。
如果 rowIndex
和 columnIndex
都是 -1,則 屬性會 CurrentCell 傳 null
回 。