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

定義

處理按鍵訊息,並產生適當的控制項事件。Processes a key message and generates the appropriate control events.

protected:
 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

參數

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. 方法會負責藉由呼叫OnKeyPress、或OnKeyUp方法, OnKeyDown為訊息產生適當的索引鍵事件。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.

安全性

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

SecurityPermission
, 讓呼叫端立即呼叫非受控碼。for the immediate caller to call unmanaged code. 相關聯的列舉:UnmanagedCodeAssociated enumeration: UnmanagedCode

適用於