Op Englesch liesen Editéieren

Deelen iwwer


MouseGesture.Matches(Object, InputEventArgs) Method

Definition

Determines whether MouseGesture matches the input associated with the specified InputEventArgs object.

C#
public override bool Matches(object targetElement, System.Windows.Input.InputEventArgs inputEventArgs);

Parameters

targetElement
Object

The target.

inputEventArgs
InputEventArgs

The input event data to compare with this gesture.

Returns

true if the event data matches this MouseGesture; otherwise, false.

Examples

The following example shows how to test whether a MouseGesture matches the input associated with an instance of an InputEventArgs. A MouseDown event handler compares the event data with the MouseGesture by using the Matches method.

C#
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");
    }
}

Applies to

Produkt Versiounen
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10