Compartir a través de


InkEditGestureEventHandler Delegate

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

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

Syntax

'Declaration
Public Delegate Sub InkEditGestureEventHandler ( _
    sender As Object, _
    e As InkEditGestureEventArgs _
)
'Usage
Dim instance As New InkEditGestureEventHandler(AddressOf HandlerMethod)
public delegate void InkEditGestureEventHandler (
    Object sender,
    InkEditGestureEventArgs e
)
public delegate void InkEditGestureEventHandler (
    Object^ sender, 
    InkEditGestureEventArgs^ e
)
/** @delegate */
public delegate void InkEditGestureEventHandler (
    Object sender, 
    InkEditGestureEventArgs e
)
Not applicable.

Parameters

  • sender
    The source InkEdit control of this event.

Remarks

An application gesture is a gesture 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 Using Gestures and Command Input on the Tablet PC.

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.

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 Stroke objects that raised the Gesture event.

The InkEdit control does not recognize multistroke 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:

  • 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 InkEditStrokeEventHandler delegate, cancel the Stroke event for the Stroke object that raised the cancelled Gesture event.

Example

This C# example alters the default action for the RightApplicationGesture.

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

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

Microsoft.Ink Namespace
ApplicationGesture
InkEdit.SetGestureStatus
InkEdit.RecoTimeout