Control.ProcessKeyMessage(Message) Control.ProcessKeyMessage(Message) Control.ProcessKeyMessage(Message) Control.ProcessKeyMessage(Message) Method

定義

處理鍵盤訊息。Processes a keyboard message.

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

參數

m
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. 方法會先決定控制項是否具有父系;若是如此, 它會呼叫父系的ProcessKeyPreview方法。The method first determines whether the control has a parent; if so, it calls the parent's ProcessKeyPreview method. 如果父系的ProcessKeyPreview方法不會處理訊息ProcessKeyEventArgs , 則會呼叫方法來產生適當的鍵盤事件。If the parent's ProcessKeyPreview method does not process the message then the ProcessKeyEventArgs method is called to generate the appropriate keyboard events. m參數包含必須處理的視窗訊息。The m parameter contains the window message that must be processed. Message.Msg屬性的可能值為 WM_CHAR、WM_KEYDOWN、WM_SYSKEYDOWN、WM_KEYUP 和 WM_SYSKEYUP。Possible values for the Message.Msg property are WM_CHAR, WM_KEYDOWN, WM_SYSKEYDOWN, WM_KEYUP, and WM_SYSKEYUP.

給繼承者的注意事項

當覆寫ProcessKeyMessage(Message)方法時, 控制項true應該傳回以指出它已處理過索引鍵。When overriding the ProcessKeyMessage(Message) method, 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 the base class's ProcessKeyEventArgs(Message) should be returned. 如果您需要覆寫這個方法, 則控制項不常發生。Controls will seldom, if ever, need to override this method.

安全性

UIPermission
適用于繼承類別以呼叫這個方法的所有視窗。for all windows for inheriting classes to call this method. 相關聯的AllWindows列舉: UIPermissionWindow的值。Associated enumeration: AllWindows value of UIPermissionWindow.

適用於

另請參閱