MouseWheelEventArgs.Delta Özellik

Tanım

Fare tekerleğinin değiştirildiği miktarı gösteren bir değer alır.

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

Özellik Değeri

Tekerleğin değiştiği miktar. Fare tekerleği yukarı yönde (kullanıcıdan uzakta) döndürülürse bu değer pozitif veya fare tekerleği aşağı yönde (kullanıcıya doğru) döndürülürse negatiftir.

Örnekler

Aşağıdaki örnek, fare tekerleği pozitifse bir TextBox yukarı, fare tekerleği Delta negatifse aşağı hareket ederTextBox.Delta TextBox, öğesine Canvaseklenir.

// 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

Açıklamalar

Bu değerin etkili üst ve alt aralıkları büyük olasılıkla cihaz uygulamalarından veya olayı tetikleyen diğer çağıranlardan gelir ve bu nedenle tanımlanmamıştır.

Şunlara uygulanır

Ayrıca bkz.