Control.ProcessKeyEventArgs(Message) Control.ProcessKeyEventArgs(Message) Control.ProcessKeyEventArgs(Message) Control.ProcessKeyEventArgs(Message) Method


处理键消息并生成适当的控件事件。Processes a key message and generates the appropriate control events.

 virtual bool ProcessKeyEventArgs(System::Windows::Forms::Message % m);
protected virtual bool ProcessKeyEventArgs (ref System.Windows.Forms.Message m);
abstract member ProcessKeyEventArgs :  -> bool
override this.ProcessKeyEventArgs :  -> bool
Protected Overridable Function ProcessKeyEventArgs (ByRef m As Message) As Boolean


Message Message Message Message

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


如果消息已由控件处理,则为 true;否则为 falsetrue if the message was processed by the control; otherwise, false.


当一个控件接收键盘消息时,调用此方法。This method is called when a control receives a keyboard message. 该方法负责生成合适的关键事件的消息通过调用OnKeyPressOnKeyDown,或OnKeyUp方法。The method is responsible for generating the appropriate key events for the message by calling the OnKeyPress, OnKeyDown, or OnKeyUp methods. m参数包含必须处理的窗口消息。The m parameter contains the window message that must be processed. 可能值为Message.Msg属性是 WM_CHAR、 WM_KEYDOWN、 WM_SYSKEYDOWN、 WM_KEYUP、 WM_SYSKEYUP 和 WM_IME_CHAR。Possible values for the Message.Msg property are WM_CHAR, WM_KEYDOWN, WM_SYSKEYDOWN, WM_KEYUP, WM_SYSKEYUP, and WM_IME_CHAR.


重写时ProcessKeyEventArgs(Message)派生类中的方法,控件应返回true以指示它已处理该键。When overriding the ProcessKeyEventArgs(Message) method in a derived class, a control should return true to indicate that it has processed the key. 不会处理由控件调用的基类的结果的密钥ProcessKeyEventArgs(Message)方法应返回。For keys that are not processed by the control, the result of calling the base class's ProcessKeyEventArgs(Message) method should be returned. 控件将很少,如果有过,需要重写此方法。Controls will seldom, if ever, need to override this method.


有关继承的类来调用此方法的所有窗口。for all windows for inheriting classes to call this method. 关联枚举:AllWindows的值UIPermissionWindowAssociated enumeration: AllWindows value of UIPermissionWindow.

直接调用方调用非托管的代码。for the immediate caller to call unmanaged code. 关联的枚举: UnmanagedCodeAssociated enumeration: UnmanagedCode