InkDeleted Event

InkDeleted Event

Occurs when a stroke is deleted from the InkDisp object.

Declaration

[C++]

void InkDeleted([in] VARIANT StrokeIds);

[Microsoft® Visual Basic® 6.0]

Public Event InkDeleted(StrokeIds)

Parameters

StrokeIds

[in] Specifies the integer array of stroke ID information for all of the strokes that have been deleted when this event occurs.

For more information about the VARIANT structure, see Using the Automation Library.

Remarks

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:

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

This event method is defined in the _IInkEvents interface. The _IInkEvents interface implements the IDispatch Leave Site interface with an identifier of DISPID_IEInkDeleted.

The InkDeleted event is fired even when in select or erase mode, not just 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.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example demonstrates adding an InkDeleted event handler to an InkDisp object. Certain strokes are deleted as soon as they are created, if they have more than two self intersections, to demonstrate the InkDeleted event. The event handler writes information about the strokes to a list box (List1).

Option Explicit
Dim WithEvents theInkCollector As InkCollector
Dim WithEvents theInk As InkDisp

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    Set theInk = theInkCollector.Ink
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True
End Sub

Private Sub theInkCollector_Stroke( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Stroke As MSINKAUTLib.IInkStrokeDisp, _
Cancel As Boolean)
    If UBound(Stroke.SelfIntersections) > 2 Then
        theInkCollector.Ink.DeleteStroke Stroke
    End If
End Sub

Private Sub theInk_InkAdded(ByVal StrokeIds As Variant)
    Dim theStrokeId As Variant
    For Each theStrokeId In StrokeIds
        List1.AddItem "Added Stroke ID " & theStrokeId
    Next
End Sub

Private Sub theInk_InkDeleted(ByVal StrokeIds As Variant)
    Dim theStrokeId As Variant
    For Each theStrokeId In StrokeIds
        List1.AddItem "Deleted Stroke ID " & theStrokeId
    Next
    Me.Refresh
End Sub

Applies To