Gesture Event

InkPicture.Gesture Event

Occurs when an application gesture is recognized.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

public event InkCollectorGestureEventHandler Gesture

For this event to occur, the InkPicture control must have interest in a set of application gestures. To set the InkPicture control's interest in a set of gestures, call the SetGestureStatus method.

For a list of specific application gestures, see the ApplicationGesture enumeration type. For more information about application gestures, see Using Gestures and Command Input on the Tablet PC.

The event handler receives an argument of type InkCollectorGestureEventArgs that contains data about this event

When you create an InkCollectorGestureEventHandler delegate, you identify the method that handles the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.

When the CollectionMode property is set to GestureOnly, the timeout between when a user adds a gesture and when the Gesture event occurs is a fixed value that you cannot alter programmatically. Gesture recognition is faster in InkAndGesture mode.

To prevent the collection of ink while in InkAndGesture mode:

To prevent the flow of ink while gesturing, set the DynamicRendering property to false.

In addition to firing when inserting ink, the Gesture event fires when InkOverlayEditingMode enumeration value Select or Delete is applied. You are responsible for tracking the editing mode and should be aware of the mode before interpreting the event.


To recognize gestures, you must use an object or control that can collect ink.


The InkPicture control uses the InkCollectorGestureEventHandler delegate to add a gesture event handler.

The event handler is this example displays application gesture information on a status bar label, statusLabelAppGesture.

void Event_OnApplicationGesture(object sender, InkCollectorGestureEventArgs e)
    // There might be more than one gesture passed in InkCollectorGestureEventArgs 
    // The gestures are arranged in order of confidence from most to least 
    // This event handler is only concerned with the first (most confident) gesture
    Gesture G = e.Gestures[0];

    // we will use the gesture if it has confidence of strong or intermediate 

    if (G.Confidence == RecognitionConfidence.Intermediate ||
        G.Confidence == RecognitionConfidence.Strong)

        switch (G.Id)
            case ApplicationGesture.Left:
                statusLabelAppGesture.Text = "Left";
            case ApplicationGesture.Right:
                statusLabelAppGesture.Text = "Right";
            case ApplicationGesture.Up:
                statusLabelAppGesture.Text = "Up";
            case ApplicationGesture.Down:
                statusLabelAppGesture.Text = "Down";


Only application gestures in which you have expressed an interest will fire this event. In this example, the InkPicture object, mInkPicture expresses an interest in four gestures of the ApplicationGesture enumeration.

// set InkPicture interest in the Left, Right, Up, Down gestures
mInkPicture.SetGestureStatus(ApplicationGesture.Left, true);
mInkPicture.SetGestureStatus(ApplicationGesture.Right, true);
mInkPicture.SetGestureStatus(ApplicationGesture.Up, true);
mInkPicture.SetGestureStatus(ApplicationGesture.Down, true);

Prior to collection of ink and gestures, the InkPicture object, mInkPicture registers the event handler.

// register the Gesture event handler
mInkPicture.Gesture += new InkCollectorGestureEventHandler(Event_OnApplicationGesture);

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.0

Community Additions

© 2016 Microsoft