Freigeben über


Ink.InkDeleted Event

Occurs when a Stroke object is deleted from the Ink object.

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

Syntax

'Declaration
Public Event InkDeleted As StrokesEventHandler
'Usage
Dim instance As Ink
Dim handler As StrokesEventHandler

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

/** @event */
public void remove_InkDeleted (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 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, you get the following sequence of events:

  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 InkDeleted event fires even when in select mode, not only when in delete mode. 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.

Example

This C# example adds an InkDeleted event handler to an Ink object. The event handler writes information about the deleted strokes to a list box, theListBox.

//...

InkCollector theInkCollector = new InkCollector(Handle);
theInkCollector.Enabled = true;
// Add a handler for InkDeleted Events to display
// their Ids in a listbox.
theInkCollector.Ink.InkDeleted += new StrokesEventHandler(InkDeleted_Event);

//...

public void InkDeleted_Event(object sender, StrokesEventArgs e)
{
    int [] theDeletedStrokeIds = e.StrokeIds;
    theListBox.Items.Clear();
    foreach (int i in theDeletedStrokeIds)
    {
        theListBox.Items.Add("Deleted Stroke Id: " + i.ToString());
    }
}

This Microsoft Visual Basic.NET example adds an InkDeleted event handler to an Ink object. The event handler writes information about the deleted strokes to a list box, theListBox.

 '...

Dim theInkCollector As New InkCollector(Handle)
theInkCollector.Enabled = true
'Add a handler for InkDeleted Events to display
'their Ids in a listbox.
AddHandler theInkCollector.Ink.InkDeleted, AddressOf InkDeleted_Event

'...

Public Sub InkDeleted_Event(ByVal sender as Object, _
    ByVal e As StrokesEventArgs)
    Dim theDeletedStrokeIds() As Integer = e.StrokeIds
    theListBox.Items.Clear()
    Dim i As Integer
    For Each i In theDeletedStrokeIds
        theListBox.Items.Add("Deleted 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

Ink Class
Ink Members
Microsoft.Ink Namespace
Ink.InkAdded
InkOverlay.EditingMode
InkOverlay.EraserMode
InkPicture.EditingMode
InkPicture.EraserMode
InkOverlay.StrokesDeleting
InkOverlay.StrokesDeleted
InkPicture.StrokesDeleting
InkPicture.StrokesDeleted
Stroke