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 : Message -> bool
override this.PreProcessMessage : Message -> 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. 控件通常将重写更专用的方法之一IsInputChar,如、、 ProcessCmdKey ProcessDialogChar、或ProcessDialogKeyIsInputKey而不是PreProcessMessage重写。Controls 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 UIPermissionWindow枚举: 值。Associated enumeration: AllWindows value of UIPermissionWindow.

适用于