DataGridView.ProcessDeleteKey(Keys) 方法

定义

处理 Delete 键。Processes the DELETE key.

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 值的按位组合,这些值表示要处理的一个或多个键。A bitwise combination of Keys values that represents the key or keys to process.

返回

Boolean

如果已处理该键,则为 true;否则为 falsetrue if the key was processed; otherwise, false.

例外

删除键将删除一行或多行,但数据源中的错误将阻止删除,并且将没有针对 DataError 事件的处理程序,或处理程序已将 ThrowException 属性设置为 trueThe DELETE key would delete one or more rows, but an error in the data source prevents the deletion and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

注解

true当用户按 delete 删除控件中的行时,此方法将返回。This method returns true when the user presses DELETE to delete rows in the control. 如果将 SelectionMode 属性设置为 FullRowSelectRowHeaderSelect ,并且 MultiSelect 属性设置为, true 则用户可以删除行。The user can delete rows if the SelectionMode property is set to FullRowSelect or RowHeaderSelect and the MultiSelect property is set to true. 如果 DataGridView 绑定到数据,则 IBindingList.AllowRemove 数据源的属性还必须设置为 trueIf the DataGridView is bound to data, the IBindingList.AllowRemove property of the data source must also be set to true.

适用于

另请参阅