# MouseWheelEventArgs Clase

## Definición

Proporciona datos para varios eventos que informan de cambios en el valor delta de la rueda del mouse.Provides data for various events that report changes to the mouse wheel delta value of a mouse device.

``public ref class MouseWheelEventArgs : System::Windows::Input::MouseEventArgs``
``public class MouseWheelEventArgs : System.Windows.Input.MouseEventArgs``
``````type MouseWheelEventArgs = class
inherit MouseEventArgs``````
``````Public Class MouseWheelEventArgs
Inherits MouseEventArgs``````
Herencia

## Ejemplos

En el ejemplo siguiente se TextBox sube un valor si la Delta rueda del mouse TextBox es positiva y se desplaza hacia abajo Delta si la rueda del mouse es negativa.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. El TextBox está asociado a un Canvas.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);
}
}

}
``````
``````' Moves the TextBox named box when the mouse wheel is rotated.
' The TextBox is on a Canvas named MainCanvas.
Private Sub MouseWheelHandler(ByVal sender As Object, ByVal e As MouseWheelEventArgs)
' If the mouse wheel delta is positive, move the box up.
If e.Delta > 0 Then
If Canvas.GetTop(box) >= 1 Then
Canvas.SetTop(box, Canvas.GetTop(box) - 1)
End If
End If

' If the mouse wheel delta is negative, move the box down.
If e.Delta < 0 Then
If (Canvas.GetTop(box) + box.Height) <= MainCanvas.Height Then
Canvas.SetTop(box, Canvas.GetTop(box) + 1)
End If
End If

End Sub
``````

## Comentarios

MouseWheelEventArgsse utiliza con los siguientes eventos:MouseWheelEventArgs is used with the following events:

La Delta propiedad es positiva si la rueda del mouse se mueve hacia arriba o hacia delante (alejándose del usuario) o negativo si la rueda del mouse se mueve hacia abajo o hacia atrás (hacia el usuario).The Delta property is positive if the mouse wheel is moved upward or forward (away from the user) or negative if the mouse wheel is moved downward or backward (toward the user).

Este evento se desencadena incluso para movimientos pequeños de la rueda del mouse.This event is raised even for small mouse wheel movements. En algunos escenarios, es adecuado implementar controladores que limiten los deltas pequeños de la rueda del mouse comprobando si la diferencia supera un umbral determinado.For some scenarios, it is appropriate to implement handlers that throttle small mouse wheel deltas by checking whether the delta exceeds a certain threshold. De lo contrario, puede invocar el controlador para los casos en los que la diferencia de la rueda del mouse era tan pequeña que cualquier interfaz de usuario que esté asociada al movimiento de la rueda del mouse no se actualizaría.Otherwise, you might invoke your handler for cases where the mouse wheel delta was so small that any UI that is tied to the mouse wheel movement would not update. Cómo implementar exactamente el comportamiento del umbral en un controlador y cuál debe ser el umbral específico de la implementación.Exactly how you implement the threshold behavior in a handler and what that threshold should be is entirely implementation-specific.

## Constructores

 Inicializa una nueva instancia de la clase MouseWheelEventArgs.Initializes a new instance of the MouseWheelEventArgs class.