Share via


DataGridView.ProcessDeleteKey(Keys) 方法

定義

處理 DELETE 鍵。

protected:
 bool ProcessDeleteKey(System::Windows::Forms::Keys keyData);
protected bool ProcessDeleteKey (System.Windows.Forms.Keys keyData);
member this.ProcessDeleteKey : System.Windows.Forms.Keys -> bool
Protected Function ProcessDeleteKey (keyData As Keys) As Boolean

參數

keyData
Keys

Keys 值的位元 (Bitwise) 組合,表示要處理的按鍵。

傳回

如果已處理按鍵,則為 true;否則為 false

例外狀況

DELETE 鍵可能會刪除一或多個資料列,但是資料來源中的錯誤會阻止這個刪除,而且 DataError 事件沒有處理常式或處理常式已將 ThrowException 屬性設定為 true

備註

當使用者按下 DELETE 以刪除 控制項中的資料列時,這個方法會 true 傳回 。 如果 SelectionMode 屬性設定 FullRowSelect 為 或 RowHeaderSelect ,且 屬性設定 true 為 , MultiSelect 則使用者可以刪除資料列。 DataGridView如果 系結至資料, IBindingList.AllowRemove 資料來源的 屬性也必須設定為 true

適用於

另請參閱