Bagikan melalui


CursorButtonDown Event

CursorButtonDown Event

Occurs when the InkCollector detects a cursor button that is down.

Declaration

[C++]

void CursorButtonDown(
    [in] IInkCursor* Cursor,
    [in] IInkCursorButton* Button
);

[Microsoft® Visual Basic® 6.0]

Public Event CursorButtonDown( _
    Cursor As IInkCursor, _
    Button As IInkCursorButton _
)

Parameters

Cursor

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

Button

[in] The button that was pressed.

Remarks

A button on a pen tip is down when the user lowers the pen to the digitizer and starts tracing a stroke. A button on a barrel is down when the button is pressed.

When you press the right mouse button, you actually receive two CursorButtonDown events — one for right button pressed and one for left button pressed.

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

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