DataGridView.ProcessKeyPreview(Message) 方法

定义

预览键盘消息。Previews a keyboard message.

protected:
 override bool ProcessKeyPreview(System::Windows::Forms::Message % m);
protected override bool ProcessKeyPreview (ref System.Windows.Forms.Message m);
override this.ProcessKeyPreview : Message -> bool
Protected Overrides Function ProcessKeyPreview (ByRef m As Message) As Boolean

参数

m
Message

通过引用传递的 Message,表示要处理的窗口消息。A Message, passed by reference, that represents the window message to process.

返回

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

异常

按下的键将导致该控件进入编辑模式,但当前单元格的 EditType 属性不指示派生自 Control 并实现 IDataGridViewEditingControl 的类。The key pressed would cause the control to enter edit mode, but the EditType property of the current cell does not indicate a class that derives from Control and implements IDataGridViewEditingControl.

此操作将提交一个单元格值或者进入编辑模式,但是数据源中的错误禁止执行此操作,DataError 事件没有处理程序,或者处理程序已将 ThrowException 属性设置为 trueThis action would commit a cell value or enter edit mode, but an error in the data source prevents the action and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

注解

有关详细信息,请参阅基类上的 Control.ProcessKeyPreview 方法。For more information, see the Control.ProcessKeyPreview method on the base class.

继承者说明

重写此方法时,控件应返回 true 来指示它已处理消息。When overriding this method, a control should return true to indicate that it has processed the message. 对于不是由控件处理的消息,返回此方法的基版本的结果。For messages that are not processed by the control, return the result of the base version of this method.

安全性

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

适用于

另请参阅