共用方式為


State Property

State Property

Returns the state of a cursor button, such as whether the button is unavailable, up, or down.

Declaration

[C++]

[propget] HRESULT get_State ([out, retval] InkCursorButtonState* State);

[Microsoft® Visual Basic® 6.0]

Public Property Get State() As InkCursorButtonState

Property Value

InkCursorButtonState A value that specifies whether the cursor button is unavailable, up, or down.

This property is read only.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER The State parameter is an invalid pointer.
E_INK_EXCEPTION An exception occurred while processing.
E_FAIL An unspecified error occurred.
E_INVALIDARG The specified mode is invalid.

Remarks

For a detailed list of state values that you can use, see the InkCursorButtonState enumeration.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example returns a report on the attributes of all of the cursors encountered by the InkCollector object passed in as a parameter.

Public Function CursorReport(ByVal theInkCollector As InkCollector) _
    As String
    Dim theReport As String
    theReport = "The InkCollector has encountered " & _
        "the following cursors so far:" & vbCrLf
    ' Get the Cursors collection from the InkCollector
    Dim theCursors As IInkCursors
    Set theCursors = theInkCollector.Cursors
    theReport = theReport & _
        "Count of cursors: " & theCursors.Count & vbCrLf
    Dim theCursor As IInkCursor
    For Each theCursor In theCursors
        theReport = theReport & "Cursor Name: " & theCursor.name & vbCrLf
        theReport = theReport & _
            "Tablet Name: " & theCursor.Tablet.name & vbCrLf
        theReport = theReport & "Cursor Id: " & theCursor.Id & vbCrLf
        theReport = theReport & "Cursor is inverted: " & _
            theCursor.Inverted & vbCrLf
        theReport = theReport & "Cursor Buttons:" & vbCrLf
        Dim theButton As IInkCursorButton
        For Each theButton In theCursor.Buttons
            Dim theState As InkCursorButtonState
                theState = theButton.State
            theReport = theReport & _
                "    Button Name: " & theButton.name & vbCrLf
            theReport = theReport & "    State: " & _
                theButton.State & vbCrLf
            theReport = theReport & "    Id: " & theButton.Id & _
                vbCrLf & vbCrLf
        Next
    Next
    CursorReport = theReport
End Function

Applies To