IMessageFilter.PreFilterMessage(Message) IMessageFilter.PreFilterMessage(Message) IMessageFilter.PreFilterMessage(Message) IMessageFilter.PreFilterMessage(Message) Method

定义

在调度消息之前将其筛选出来。Filters out a message before it is dispatched.

public:
 bool PreFilterMessage(System::Windows::Forms::Message % m);
public bool PreFilterMessage (ref System.Windows.Forms.Message m);
abstract member PreFilterMessage : Message -> bool
Public Function PreFilterMessage (ByRef m As Message) As Boolean

参数

m
Message Message Message Message

要调度的消息。The message to be dispatched. 无法修改此消息。You cannot modify this message.

返回

如果筛选消息并禁止消息被调度,则为 true;如果允许消息继续到达下一个筛选器或控件,则为 falsetrue to filter the message and stop it from being dispatched; false to allow the message to continue to the next filter or control.

注解

用于PreFilterMessage在消息被调度到控件或窗体之前筛选出消息。Use PreFilterMessage to filter out a message before it is dispatched to a control or form. 例如Click ,若要停止将某个Button控件的事件调度到该PreFilterMessage控件,可以实现方法,并在Click消息发生时true返回一个值。For example, to stop the Click event of a Button control from being dispatched to the control, you implement the PreFilterMessage method and return a true value when the Click message occurs. 你还可以使用此方法来执行在调度消息之前可能需要执行的代码工作。You can also use this method to perform code work that you might need to do before the message is dispatched.

安全性

SecurityPermission
UnmanagedCode链接时需要权限。Requires UnmanagedCode permission at link time.

适用于