ButtonBase.OnMouseMove(MouseEventArgs) 方法

定義

引發 OnMouseMove(MouseEventArgs) 事件。Raises the OnMouseMove(MouseEventArgs) event.

protected:
 override void OnMouseMove(System::Windows::Forms::MouseEventArgs ^ mevent);
protected override void OnMouseMove (System.Windows.Forms.MouseEventArgs mevent);
override this.OnMouseMove : System.Windows.Forms.MouseEventArgs -> unit
Protected Overrides Sub OnMouseMove (mevent As MouseEventArgs)

參數

mevent
MouseEventArgs

MouseEventArgs,其中包含事件資料。A MouseEventArgs that contains the event data.

備註

引發事件會透過委派叫用此事件處理常式。Raising an event invokes the event handler through a delegate. 如需詳細資訊,請參閱 處理和引發事件For more information, see Handling and Raising Events.

OnMouseMove 方法也允許衍生類別處理事件,而不用附加委派。The OnMouseMove method also allows derived classes to handle the event without attaching a delegate. 這是在衍生類別中處理事件的慣用技巧。This is the preferred technique for handling the event in a derived class.

注意

OnMouseMove如果按鈕已停用,請不要呼叫 (這包括 OnMouseMove 當您在衍生類別中覆寫時,呼叫基類的方法 OnMouseMove) 。Do not call OnMouseMove if the button is disabled (this includes calls to the base class's OnMouseMove method when you override OnMouseMove in a derived class). 停用覆寫中的按鈕時 OnMouseMove ,請在停用按鈕之前呼叫基類的 OnMouseMove 方法,或完全不要呼叫。When disabling the button in an override of OnMouseMove, call the base class's OnMouseMove method before disabling the button, or do not call it at all.

給繼承者的注意事項

當在衍生類別中覆寫 OnMouseMove(MouseEventArgs) 時,請確定呼叫基底類別的 OnMouseMove(MouseEventArgs) 方法,使已註冊的委派能接收到事件。When overriding OnMouseMove(MouseEventArgs) in a derived class, be sure to call the base class's OnMouseMove(MouseEventArgs) method so that registered delegates receive the event.

適用於