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.

返回

如果已处理该键,则为 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.

注解

当用户按 DELETE 删除控件中的行时,此方法将返回 trueThis method returns true when the user presses DELETE to delete rows in the control. 如果 @no__t 0 属性设置为 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 绑定到数据,则还必须将数据源的 @no__t 属性设置为 trueIf the DataGridView is bound to data, the IBindingList.AllowRemove property of the data source must also be set to true.

安全性

SecurityPermission
用于调用非托管代码。for calling unmanaged code. 需求值: LinkDemandDemand value: LinkDemand. 权限值: UnmanagedCodePermission value: UnmanagedCode

适用于

另请参阅