Bagikan melalui


SelectionResized Event

SelectionResized Event

Occurs when the size of the current selection has changed, for example through alterations to the user interface, cut-and-paste procedures, or the Selection property.

Declaration

[C++]

void SelectionResized([in] IInkRectangle* OldSelectionRect);

[Microsoft® Visual Basic® 6.0]

Public Event SelectionResized(OldSelectionRect As InkRectangle)

Parameters

OldSelectionRect

[in] The bounding rectangle of the selected InkStrokes collection as it existed before the SelectionResized event fired.

Note: This rectangle is specified in ink space coordinates, which allows for undo scenarios.

Remarks

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

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
        theInkCollector.EditingMode = IOEM_Select
        Command1.Caption = "Select"
    ElseIf theInkCollector.EditingMode = IOEM_Select Then
        theInkCollector.EditingMode = IOEM_Delete
        Command1.Caption = "Delete"
    Else
        theInkCollector.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