Share via


StrokesEventHandler Delegate

Represents the method that handles events for adding and removing Strokes on the Ink object, InkOverlay object, InkPicture control, and Strokes collection.

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

Syntax

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

Parameters

  • sender
    The source Ink object or Strokes collection of this event.

Remarks

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

Example

This C# example adds an InkAdded event handler to an Ink object associated with an InkCollector object, theInkCollector. The event handler writes information about the added strokes to a list box, theListBox.

//...

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;
    theListBox.Items.Clear();
    foreach (int i in theAddedStrokeIds)
    {
        theListBox.Items.Add("Added Stroke Id: " + i.ToString());
    }
}

This Microsoft® Visual Basic® .NET example adds an InkAdded event handler to an Ink object associated with an InkCollector object, theInkCollector. The event handler writes information about the added strokes to a list box, theListBox.

'...

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
    theListBox.Items.Clear()
    Dim i As Integer
    For Each i In theAddedStrokeIds
        theListBox.Items.Add("Added Stroke Id: " & i.ToString())
    Next
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
Ink.InkAdded
Ink.InkDeleted
Strokes.StrokesAdded
Strokes.StrokesRemoved