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
)
JScript does not support delegates.

Parameters

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.

Examples

In this example, an InkAdded event handler writes information about the added strokes to a list box control.

Private Sub Ink_InkAdded(ByVal sender As Object, ByVal e As StrokesEventArgs)
    ' since this event fires in all modes, we will check EditingMode 
    ' and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Ink  
    If InkOverlayEditingMode.Ink = Me.mInkOverlay.EditingMode Then 
        For Each id As Integer In e.StrokeIds
            Me.listBoxStrokeId.Items.Add("Added ID:" + id.ToString())
        Next 
    End If 
End Sub
private void Ink_InkAdded(object sender, StrokesEventArgs e)
{
    // since this event fires in all modes, we will check EditingMode 
    // and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Ink  
    if (InkOverlayEditingMode.Ink == this.mInkOverlay.EditingMode)
    {
        foreach (int id in e.StrokeIds)
        {
            this.listBoxStrokeId.Items.Add("Added ID:" + id.ToString());

        }
    }
}

In this example an InkDeleted event handler writes information about the deleted strokes to a list box control.

Private Sub Ink_InkDeleted(ByVal sender As Object, ByVal e As StrokesEventArgs)
    ' since this event fires in select mode also, we will check EditingMode 
    ' and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Delete  
    If InkOverlayEditingMode.Delete = Me.mInkOverlay.EditingMode Then 
        For Each id As Integer In e.StrokeIds
            Me.listBoxStrokeId.Items.Add("Deleted ID:" + id.ToString())
        Next 
    End If 
End Sub
private void Ink_InkDeleted(object sender, StrokesEventArgs e)
{
    // since this event fires in select mode also, we will check EditingMode 
    // and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Delete  
    if (InkOverlayEditingMode.Delete == this.mInkOverlay.EditingMode)
    {
        foreach (int id in e.StrokeIds)
        {
            this.listBoxStrokeId.Items.Add("Deleted ID:" + id.ToString());

        }
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Microsoft.Ink Namespace

Ink.InkAdded

Ink.InkDeleted

Strokes.StrokesAdded

Strokes.StrokesRemoved