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

包含事件数据的 MouseEventArgsA MouseEventArgs that contains the event data.


如果垂直滚动条是可见的,这意味着该VScroll属性设置为trueScrollableControl鼠标滚轮会垂直滚动控件。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.