共用方式為


StrokesDeleting Event

StrokesDeleting Event

Occurs before strokes are deleted from the Ink property.

Declaration

[C++]

void StrokesDeleting([in] IInkStrokes* Strokes);

[Microsoft® Visual Basic® 6.0]

Public Event StrokesDeleting(Strokes As InkStrokes)

Parameters

Strokes

[in] The InkStrokes collection deleted when the StrokesDeleting event fires.

Remarks

This event method is defined in the _IInkOverlayEvents and _IInkPictureEvents dispatch-only interfaces (dispinterfaces) with an ID of DISPID_IOEStrokesDeleting.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates an InkOverlay object and allows the user to alternately ink, select, and delete the ink by setting the EditingMode property, while reporting details on the SelectionMoved, SelectionMoving, SelectionResized, SelectionResizing, StrokesDeleted and StrokesDeleting events within a text box. This application starts with a standard .exe application and adds a reference to Microsoft Tablet PC Type Library, a Picture control, Picture1, a command button, Command1, and a text box, Text1, then adds the following code to the form.

Option Explicit
Private WithEvents theInkOverlay As InkOverlay

Private Sub Command1_Click()
    'Set the EditingMode to the next of
    'the options with each click of the
    'button.
    If theInkOverlay.CollectingInk = True Then
        'This is hard to do unless you are using
        'multiple cursors at once.
        Text1.Text = "Can't switch while collecting ink"
    ElseIf theInkOverlay.EditingMode = IOEM_Ink Then
        theInkOverlay.EditingMode = IOEM_Select
        Command1.Caption = "Select"
    ElseIf theInkOverlay.EditingMode = IOEM_Select Then
        theInkOverlay.EditingMode = IOEM_Delete
        Command1.Caption = "Delete"
    Else
        theInkOverlay.EditingMode = IOEM_Ink
        Command1.Caption = "Ink"
    End If
End Sub

Private Sub Form_Load()
    'Set the InkOverlay to work in the
    'panel of the Picture1 control.
    Set theInkOverlay = New InkOverlay
    theInkOverlay.hWnd = Picture1.hWnd
    theInkOverlay.Enabled = True
    Command1.Caption = "Ink"
    Text1.Text = ""
End Sub

Private Sub theInkOverlay_SelectionMoved( _
ByVal OldSelectionRect As InkRectangle)
    Text1.Text = "SelectionMoved: (" _
        & OldSelectionRect.Left & ", " _
        & OldSelectionRect.Top & ", " _
        & OldSelectionRect.Right & ", " _
        & OldSelectionRect.Bottom & ")"
End Sub

Private Sub theInkOverlay_SelectionMoving( _
ByVal CurSelectionRect As InkRectangle)
    Text1.Text = "SelectionMoving: (" _
        & CurSelectionRect.Left & ", " _
        & CurSelectionRect.Top & ", " _
        & CurSelectionRect.Right & ", " _
        & CurSelectionRect.Bottom & ")"
End Sub

Private Sub theInkOverlay_SelectionResized( _
ByVal OldSelectionRect As InkRectangle)
    Text1.Text = "SelectionResized: (" _
        & OldSelectionRect.Left & ", " _
        & OldSelectionRect.Top & ", " _
        & OldSelectionRect.Right & ", " _
        & OldSelectionRect.Bottom & ")"
End Sub

Private Sub theInkOverlay_SelectionResizing( _
ByVal CurSelectionRect As InkRectangle)
    Text1.Text = "SelectionResizing: (" _
        & CurSelectionRect.Left & ", " _
        & CurSelectionRect.Top & ", " _
        & CurSelectionRect.Right & ", " _
        & CurSelectionRect.Bottom & ")"
End Sub

Private Sub theInkOverlay_StrokesDeleted()
    Text1.Text = "StrokesDeleted"
End Sub

Private Sub theInkOverlay_StrokesDeleting( _
ByVal Strokes As InkStrokes)
    'If you want to be able to undo this,
    'this might be a good time to save these
    'strokes somewhere.
    Text1.Text = "StrokesDeleting: " _
        & Strokes.Count & " will be deleted"
End Sub

Applies To