Control.OnNotifyMessage(Message) 方法

定义

向控件通知 Windows 消息。Notifies the control of Windows messages.

protected:
 virtual void OnNotifyMessage(System::Windows::Forms::Message m);
protected virtual void OnNotifyMessage (System.Windows.Forms.Message m);
abstract member OnNotifyMessage : System.Windows.Forms.Message -> unit
override this.OnNotifyMessage : System.Windows.Forms.Message -> unit
Protected Overridable Sub OnNotifyMessage (m As Message)

参数

m
Message

一个 Message,它表示 Windows 消息。A Message that represents the Windows message.

注解

如果在 ControlStyles中设置了控件的 EnableNotifyMessage 样式位,则调用 OnNotifyMessage 方法。The OnNotifyMessage method is called if the control's EnableNotifyMessage style bit is set in ControlStyles. ControlStyles 中的 EnableNotifyMessage 样式使控件在 WndProc 方法收到 Windows 消息时得到通知。The EnableNotifyMessage style in ControlStyles enables the control to be notified when the WndProc method receives a Windows message. 利用此方法,不完全受信任的控件可以侦听 Windows 消息,而无需使消息修改消息。With this method, semi-trusted controls can listen for Windows messages without enabling them to modify the message.

继承者说明

在派生类中重写 OnNotifyMessage(Message) 时,不需要调用基类的 OnNotifyMessage(Message) 方法,因为没有初始实现。When overriding OnNotifyMessage(Message) in a derived class, calling the base class's OnNotifyMessage(Message) method is not necessary because there is no initial implementation.

适用于