Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Method

定义

在调度键盘或输入消息之前,在消息循环内对它们进行预处理。Preprocesses keyboard or input messages within the message loop before they are dispatched.

public:
 virtual bool PreProcessMessage(System::Windows::Forms::Message % msg);
public virtual bool PreProcessMessage (ref System.Windows.Forms.Message msg);
abstract member PreProcessMessage :  -> bool
override this.PreProcessMessage :  -> bool
Public Overridable Function PreProcessMessage (ByRef msg As Message) As Boolean

参数

msg
Message Message Message Message

通过引用传递的 Message,表示要处理的消息。A Message, passed by reference, that represents the message to process. 可能的值有 WM_KEYDOWN、WM_SYSKEYDOWN、WM_CHAR 和 WM_SYSCHAR。The possible values are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

返回

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

注解

PreProcessMessage 由应用程序的消息循环进行预处理输入的消息之前对它们调用。PreProcessMessage is called by the application's message loop to preprocess input messages before they are dispatched. 可能值为msg参数是 WM_KEYDOWN、 WM_SYSKEYDOWN、 WM_CHAR 和 WM_SYSCHAR。Possible values for the msg parameter are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

重写时PreProcessMessage,控制应返回true以指示它已处理该消息。When overriding PreProcessMessage, a control should return true to indicate that it has processed the message. 对于不处理由控件的结果消息,base.PreProcessMessage应返回。For messages that are not processed by the control, the result of base.PreProcessMessage should be returned. 控件通常将如覆盖更专用的方法之一IsInputCharIsInputKeyProcessCmdKeyProcessDialogChar,或ProcessDialogKey而不是替代PreProcessMessageControls will typically override one of the more specialized methods such as IsInputChar, IsInputKey, ProcessCmdKey, ProcessDialogChar, or ProcessDialogKey instead of overriding PreProcessMessage.

安全性

UIPermission
对于直接调用方调用此方法的所有窗口。for all windows for the immediate caller to call this method. 关联枚举:AllWindows的值UIPermissionWindowAssociated enumeration: AllWindows value of UIPermissionWindow.

适用于