MouseGesture.Matches(Object, InputEventArgs) Metoda

Definicja

Określa, czy MouseGesture pasuje do danych wejściowych skojarzonych z określonym InputEventArgs obiektem.

public:
 override bool Matches(System::Object ^ targetElement, System::Windows::Input::InputEventArgs ^ inputEventArgs);
public override bool Matches (object targetElement, System.Windows.Input.InputEventArgs inputEventArgs);
override this.Matches : obj * System.Windows.Input.InputEventArgs -> bool
Public Overrides Function Matches (targetElement As Object, inputEventArgs As InputEventArgs) As Boolean

Parametry

targetElement
Object

Cel.

inputEventArgs
InputEventArgs

Dane wejściowe zdarzenia do porównania z tym gestem.

Zwraca

true jeśli dane zdarzenia są zgodne z tym MouseGesture; falsew przeciwnym razie .

Przykłady

W poniższym przykładzie pokazano, jak sprawdzić, czy element MouseGesture jest zgodny z danymi wejściowymi skojarzonymi z wystąpieniem klasy InputEventArgs. Procedura MouseDown obsługi zdarzeń porównuje dane zdarzenia z MouseGesture metodą przy użyciu Matches metody .

private void OnMouseDown(object sender, MouseEventArgs e)
{
    MouseGesture mouseGesture = new MouseGesture(MouseAction.MiddleClick,ModifierKeys.Control);

    if (mouseGesture.Matches(null, e))
    {
        MessageBox.Show("Trapped Mouse Gesture");
    }
}
Private Overloads Sub OnMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim mouseGesture As New MouseGesture(MouseAction.MiddleClick,ModifierKeys.Control)

    If mouseGesture.Matches(Nothing, e) Then
        MessageBox.Show("Trapped Mouse Gesture")
    End If
End Sub

Dotyczy