MouseWheelEventArgs.Delta 속성

정의

마우스 휠이 변경된 양을 나타내는 값을 가져옵니다.

public:
 property int Delta { int get(); };
public int Delta { get; }
member this.Delta : int
Public ReadOnly Property Delta As Integer

속성 값

휠이 변경된 양입니다. 이 값은 마우스 휠이 위쪽(사용자 반대쪽)으로 회전하면 양수이고 마우스 휠이 아래쪽(사용자 쪽)으로 회전하면 음수입니다.

예제

다음 예에서는 TextBox 경우 마우스 휠을 Delta 가 양수이 고 이동 합니다 TextBox 경우 아래로 마우스 휠을 Delta 음수인 합니다. 합니다 TextBox 에 연결할 때는 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

설명

이 값의 유효 상한 및 하 한 범위 디바이스 구현 또는 이벤트 발생 및 정의 되지 않은 다른 호출자에서 잠재적으로 제공 됩니다.

적용 대상

추가 정보