다음을 통해 공유


StrokesEventHandler Delegate

StrokesEventHandler Delegate

Represents the method that handles stroke adding and removing events of the Ink object, InkOverlay object, InkPicture object, and Strokes collection.

Definition

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

Parameters

sender System.Object. [in] Specifies the source Ink object or Strokes collection of this event.
e Microsoft.Ink.StrokesEventArgs. [in] Specifies the StrokesEventArgs 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

When you create a StrokesEventHandler 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 StrokesEventHandler delegate is used to implement the InkAdded, InkDeleted, StrokesAdded, and StrokesRemoved event handlers.

Examples

[C#]

This C# example demonstrates adding an InkAdded event handler to an Ink object. The event handler writes information about the added strokes to a list box, listBox1.

//...

InkCollector theInkCollector = new InkCollector(Handle);
theInkCollector.Enabled = true;
// Add a handler for InkAdded Events to display
// their Ids in a listbox.
theInkCollector.Ink.InkAdded += new StrokesEventHandler(InkAdded_Event);

//...

public void InkAdded_Event(object sender, StrokesEventArgs e)
{
    int [] theAddedStrokeIds = e.StrokeIds;
    listBox1.Items.Clear();
    foreach (int i in theAddedStrokeIds)
    {
        listBox1.Items.Add("Added Stroke Id: " + i.ToString());
    }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example demonstrates adding an InkAdded event handler to an Ink object. The event handler writes information about the added strokes to a list box, ListBox1.

'...

Dim theInkCollector As New InkCollector(Handle)
theInkCollector.Enabled = true
'Add a handler for InkAdded Events to display
'their Ids in a listbox.
AddHandler theInkCollector.Ink.InkAdded, AddressOf InkAdded_Event

'...

Public Sub InkAdded_Event(ByVal sender as Object, _
    ByVal e As StrokesEventArgs)
    Dim theAddedStrokeIds() As Integer = e.StrokeIds
    ListBox1.Items.Clear()
    Dim i As Integer
    For Each i In theAddedStrokeIds
        ListBox1.Items.Add("Added Stroke Id: " & i.ToString())
    Next
End Sub

See Also