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

代表 Windows 訊息的 MessageA 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.

適用於