다음을 통해 공유


InkEdit.Stroke Event

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

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

Syntax

'Declaration
Public Event Stroke As InkEditStrokeEventHandler
'Usage
Dim instance As InkEdit
Dim handler As InkEditStrokeEventHandler

AddHandler instance.Stroke, handler
public event InkEditStrokeEventHandler Stroke
public:
event InkEditStrokeEventHandler^ Stroke {
    void add (InkEditStrokeEventHandler^ value);
    void remove (InkEditStrokeEventHandler^ value);
}
/** @event */
public void add_Stroke (InkEditStrokeEventHandler value)

/** @event */
public void remove_Stroke (InkEditStrokeEventHandler 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 InkCollectorStrokeEventArgs that contains data about this event.

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

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
InkCollectorStrokeEventArgs
Cursor
Stroke
Strokes.StrokesAdded