Compartir a través de


CursorInRange Event

CursorInRange Event

Occurs when a cursor enters the physical detection range (proximity) of the tablet context.

Declaration

[C++]

void CursorInRange(
    [in] IInkCursor* Cursor,
    [in] VARIANT_BOOL NewCursor,
    [in] VARIANT ButtonsState
);

[Microsoft® Visual Basic® 6.0]

Public Event CursorInRange ( _
    Cursor As IInkCursor, _
    NewCursor As Boolean, _
    ButtonsState _
)

Parameters

Cursor

[in] The IInkCursor object that generated the CursorInRange event.

NewCursor

[in] Whether this is the first time this ink collector has come in contact with the IInkCursor object that generated the CursorInRange event.

ButtonsState

[in] The state of the buttons for the cursor that generated the CursorInRange event.

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

Remarks

This event method is defined in the _IInkCollectorEvents, _IInkOverlayEvents, and _IInkPictureEvents dispatch-only interface (dispinterfaces) with an ID of DISPID_ICECursorInRange.

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

[Visual Basic 6.0]

This Visual Basic 6.0 example demonstrates using event handlers to display the state of the cursor buttons and whether the cursor is in or out of range. This simple application has a text edit control, Text1, where messages appear when events are received.

Option Explicit
Dim WithEvents theInkCollector As InkCollector

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

    theInkCollector.SetEventInterest ICEI_CursorButtonUp, True
    theInkCollector.SetEventInterest ICEI_CursorButtonDown, True
End Sub

Private Sub theInkCollector_CursorButtonUp( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = _
    "Cursor " & Cursor.Name & "." & Button.Name & " button up"
End Sub

Private Sub theInkCollector_CursorButtonDown( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = _
    "Cursor " & Cursor.Name & "." & Button.Name & " button down"
End Sub

Private Sub theInkCollector_CursorInRange( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal NewCursor As Boolean, _
ByVal ButtonsState As Variant)
    Text1.Text = _
    "Cursor " & Cursor.Name & " in range, NewCursor is " & NewCursor
End Sub

Private Sub theInkCollector_CursorOutOfRange( _
ByVal Cursor As MSINKAUTLib.IInkCursor)
    Text1.Text = "Cursor " & Cursor.Name & " out of range"
End Sub

Applies To