Share via


InkEdit.Stroke Event

InkEdit.Stroke Event

Occurs when the user finishes drawing a new stroke on any tablet.

Definition

Visual Basic .NET Public Event Stroke As InkEditStrokeEventHandler
C# public event InkEditStrokeEventHandler Stroke;
Managed C++ public: __event InkEditStrokeEventHandler Stroke;

Remarks

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

When you create an InkCollectorStrokeEventHandler 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. The default event interest is on.

Examples

[C#]

This C# example demonstrates how to alter 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;
  }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example demonstrates how to alter 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

See Also