Share via


Strokes.StrokesAdded Event

Strokes.StrokesAdded Event

Occurs when one or more strokes are added to the Strokes collection.

Definition

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

Remarks

The event handler receives an argument of type StrokesEventArgs containing data about this event.

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.

Examples

[C#]

This C# example demonstrates adding a StrokesAdded event handler to a Strokes collection object. The event handler writes information about the added strokes to a list box, listBox1.

//...

// Add a handler for StrokesAdded Events so we can display
// their IDs in a listbox.
theStrokes.StrokesAdded += new StrokesEventHandler(StrokesAdded_Event);

//...

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

[Visual Basic .NET]

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

'...

'Add a handler for StrokesAdded events so we can display
'their IDs in a listbox.
AddHandler theStrokes.StrokesAdded, AddressOf StrokesAdded_Event

'...

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

See Also