Freigeben über


InkEdit.Gesture Event

Occurs when an application gesture is recognized.

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

Syntax

'Declaration
Public Event Gesture As InkEditGestureEventHandler
'Usage
Dim instance As InkEdit
Dim handler As InkEditGestureEventHandler

AddHandler instance.Gesture, handler
public event InkEditGestureEventHandler Gesture
public:
event InkEditGestureEventHandler^ Gesture {
    void add (InkEditGestureEventHandler^ value);
    void remove (InkEditGestureEventHandler^ value);
}
/** @event */
public void add_Gesture (InkEditGestureEventHandler value)

/** @event */
public void remove_Gesture (InkEditGestureEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

Remarks

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

When you create an InkEditGestureEventHandler 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.

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 InkEdit.SetGestureStatus method. The InkEdit control does not recognize multiple stroke gestures.

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

In the InkEdit control, a Gesture event is raised only if the gesture is the first stroke since either 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 Stroke objects that raised the Gesture event.

To alter the default action for a gesture

  • Add event handlers for the Gesture and Stroke events.

  • In the Gesture event handler, cancel the Gesture event for the gesture, and perform the alternate action for the gesture.

  • In the Stroke event handler, cancel the Stroke event for the Stroke object that raised the cancelled Gesture event.

Example

This C# example alters the default action for the "Right" application gesture by capturing and canceling both a Gesture and Stroke event.

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;
  }
}

This Microsoft Visual Basic .NET example alters the default action for the "Right" application gesture by capturing and canceling both a Gesture and Stroke event.

Private theStrokeID As Integer
//...
Private Sub InkEdit1_Gesture(ByVal sender As Object, ByVal e As Microsoft.Ink.InkEditGestureEventArgs)
Handles InkEdit1.Gesture
    If e.Gestures(0).Id = ApplicationGesture.Right Then
        theStrokeID = e.Strokes(0).Id
        e.Cancel = True
    End If
End Sub

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

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkEdit Class
InkEdit Members
Microsoft.Ink Namespace
InkEditGestureEventArgs
ApplicationGesture
InkEdit.SetGestureStatus
InkEdit.RecoTimeout