다음을 통해 공유


Strokes.StrokesAdded Event

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

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

Syntax

'Declaration
Public Event StrokesAdded As StrokesEventHandler
'Usage
Dim instance As Strokes
Dim handler As StrokesEventHandler

AddHandler instance.StrokesAdded, handler
public event StrokesEventHandler StrokesAdded
public:
event StrokesEventHandler^ StrokesAdded {
    void add (StrokesEventHandler^ value);
    void remove (StrokesEventHandler^ value);
}
/** @event */
public void add_StrokesAdded (StrokesEventHandler value)

/** @event */
public void remove_StrokesAdded (StrokesEventHandler 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 StrokesEventArgs containing data about this event.

When you create a StrokesEventHandler delegate, you identify the method handling 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.

Example

This C# example adds an StrokesAdded event handler to a Strokes collection object. The event handler writes information about the added strokes to a list box, theListBox.

//...

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

This Microsoft Visual Basic.NET example adds an StrokesAdded event handler to a Strokes collection object. The event handler writes information about the added strokes to a list box, theListBox.

'...

'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
    theListBox.Items.Clear()
    Dim i As Integer
    For Each i In theAddedStrokesIDs
        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

Strokes Class
Strokes Members
Microsoft.Ink Namespace
Ink
Microsoft.Ink.Strokes.Add