Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Ink Class
Ink Events
 InkAdded Event
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Ink..::.InkAdded Event

Occurs when a Stroke object is added to the Ink object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)
Visual Basic (Declaration)
Public Event InkAdded As StrokesEventHandler
Visual Basic (Usage)
Dim instance As Ink
Dim handler As StrokesEventHandler

AddHandler instance.InkAdded, handler
C#
public event StrokesEventHandler InkAdded
Visual C++
public:
 event StrokesEventHandler^ InkAdded {
    void add (StrokesEventHandler^ value);
    void remove (StrokesEventHandler^ value);
}
JScript
JScript does not support events.

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

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.

If you use the InkOverlay object or the InkPicture control (where EditingMode equals Delete and EraserMode equals StrokeErase) and pass the eraser over a stroke, the following sequence of events occurs:

  1. InkDeleted

  2. InkAdded

  3. InkDeleted

The additional InkAdded and InkDeleted events occur because the underlying code adds an internal, invisible stroke to track the eraser.

The InkAdded event fires even when in select or erase mode, not only when inserting ink. This requires that you monitor the editing mode (which you are responsible for setting) and be aware of the mode before interpreting the event. The advantage of this requirement is greater freedom to innovate on the platform through greater awareness of platform events.

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

Visual Basic
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
C#
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());

        }
    }
}

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.

.NET Framework

Supported in: 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker