ScrollableControl.OnMouseWheel(MouseEventArgs) ScrollableControl.OnMouseWheel(MouseEventArgs) ScrollableControl.OnMouseWheel(MouseEventArgs) ScrollableControl.OnMouseWheel(MouseEventArgs) Method


引發 MouseWheel 事件。Raises the MouseWheel event.

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


MouseEventArgs MouseEventArgs MouseEventArgs MouseEventArgs

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


如果垂直捲動條是可見的,這表示VScroll屬性設定為true,則ScrollableControl滑鼠滾輪會垂直捲動控制項。If the vertical scroll bar is visible, which means that the VScroll property is set to true, the mouse wheel scrolls through the ScrollableControl control vertically. 不過,如果只有水準捲軸是可見VScroll的,這表示會設定為false ,而HScroll設定為true,滑鼠滾輪的屬性會水準滾動。However, if only the horizontal scroll bar is visible, which means that the VScroll is set to false and the HScroll property to set to true, the mouse wheel scrolls horizontally.

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

OnMouseWheel 方法也允許衍生類別處理事件,而不用附加委派。The OnMouseWheel 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.


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