InkEditGestureEventHandler Delegate

InkEditGestureEventHandler Delegate

Represents the method that handles the Gesture event of an InkEdit control.

Definition

Visual Basic .NET Public Delegate Sub InkEditGestureEventHandler( _
ByVal sender As Object, _
ByVal e As InkEditGestureEventArgs _
)
C# public delegate void InkEditGestureEventHandler(
object sender,
InkEditGestureEventArgs e
);
Managed C++ public: __gc __delegate void InkEditGestureEventHandler(
Object *sender,
InkEditGestureEventArgs *e
);

Parameters

sender System.Object. [in] Specifies the source InkEdit of this event.
e Microsoft.Ink.InkEditGestureEventArgs. [in] Specifies the InkEditGestureEventArgs object that contains the event data.

Delegate Information

Namespace Microsoft.Ink
Assembly Microsoft.Ink (microsoft.ink.dll)
Strong Name Microsoft.Ink, Version=1.7.4009.0, Culture=neutral, PublicKeyToken=a2870d9cc4d021c8

Remarks

Application gestures are defined as gestures that are supported within your application.

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

For a list of specific application gestures, see the ApplicationGesture enumeration type. For more information about application gestures, see Making Windows Work with a Pen.

When you create an InkEditGestureEventHandler delegate, you identify the method that will handle 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.

In the InkEdit control, a Gesture event is raised only if the gesture is the first stroke since the last call to the Recognize method or the last firing of the recognition timeout.

If the Gesture event is cancelled, the Stroke event is raised for the strokes that raised the Gesture event.

The Gesture event is only raised for gestures that the InkEdit control has an interest in. Use the InkEdit control's SetGestureStatus method to change the gestures that the control is interested in. The InkEdit control does not recognize multiple stroke gestures.

The InkEdit control has default interest in and actions for the following gestures:

Gesture Action
Down-left,Down-left-long Enter
Right Space
Left Backspace
Up-right,Up-right-long Tab

To alter the default action for a gesture:

Examples

[C#]

This C# example demonstrates how to alter the default action for the Right application gesture.

private int theStrokeID;
private void inkEdit1_Gesture(object sender,
    Microsoft.Ink.InkEditGestureEventArgs e)
{
  if (e.Gestures[0].Id == ApplicationGesture.Right)
  {
    theStrokeID = e.Strokes[0].Id;
    e.Cancel = true;
  }
}
private void inkEdit1_Stroke(object sender,
    Microsoft.Ink.InkEditStrokeEventArgs e)
{
  if (e.Stroke.Id == theStrokeID)
  {
    System.Diagnostics.Debug.WriteLine("Right-Gesture recognized");
    e.Cancel = true;
  }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example demonstrates how to alter the default action for the Right application gesture.

Dim theStrokeID As Integer

Public Sub InkEdit1_Gesture(ByVal sender As Object, ByVal e As _
                             InkEditGestureEventArgs)
  If e.Gestures(0).Id = ApplicationGesture.Right Then
    theStrokeID = e.Strokes(0).Id
    e.Cancel = True
  End If
End Sub

Public Sub InkEdit1_Stroke(ByVal sender As Object, ByVal e As _
                            InkEditStrokeEventArgs)
  If e.Stroke.Id = theStrokeID Then
    System.Diagnostics.Debug.WriteLine("Right-Gesture recognized")
    e.Cancel = True
  End If
End Sub

See Also