MouseWheelEventArgs Class
.NET Framework 3.0
Provides event data for the MouseWheel event.
Namespace: System.Windows.Input
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
MouseWheelEventArgs is used with the following events: MouseWheel and PreviewMouseWheel.
The Delta property is positive if the mouse wheel is moved forward (away from the user) or negative if the mouse wheel is moved downward (toward the user).
The following example moves a TextBox up if the mouse wheel Delta is positive and moves the TextBox down if the mouse wheel Delta is negative. The TextBox is attached to a Canvas.
// Moves the TextBox named box when the mouse wheel is rotated. // The TextBox is on a Canvas named MainCanvas. private void MouseWheelHandler(object sender, MouseWheelEventArgs e) { // If the mouse wheel delta is positive, move the box up. if (e.Delta > 0) { if (Canvas.GetTop(box) >= 1) { Canvas.SetTop(box, Canvas.GetTop(box) - 1); } } // If the mouse wheel delta is negative, move the box down. if (e.Delta < 0) { if ((Canvas.GetTop(box) + box.Height) <= (MainCanvas.Height)) { Canvas.SetTop(box, Canvas.GetTop(box) + 1); } } }
System.Object
System.EventArgs
System.Windows.RoutedEventArgs
System.Windows.Input.InputEventArgs
System.Windows.Input.MouseEventArgs
System.Windows.Input.MouseWheelEventArgs
System.EventArgs
System.Windows.RoutedEventArgs
System.Windows.Input.InputEventArgs
System.Windows.Input.MouseEventArgs
System.Windows.Input.MouseWheelEventArgs
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: