Share via


InkOverlay.Cursors Property

Gets the Cursors collection that is available for use in the inking region.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public ReadOnly Property Cursors As Cursors
'Usage
Dim instance As InkOverlay
Dim value As Cursors

value = instance.Cursors
public Cursors Cursors { get; }
public:
property Cursors^ Cursors {
    Cursors^ get ();
}
/** @property */
public Cursors get_Cursors ()
public function get Cursors () : Cursors
Not applicable.

Property Value

The Cursors collection that is available for use in the inking region.

Remarks

Each cursor corresponds to the tip of a pen or other ink input device.

The cursors in this collection are local to an InkOverlay object.

Any new cursors that the InkOverlay object encounters are added to the returned Cursors collection, although the cursors are not necessarily returned in the order in which the InkOverlay object encounters them.

When you enable a mouse as an input device on the InkOverlay object (when the useMouseForInput parameter of the SetAllTabletsMode method is true), the mouse is added to the Cursors collection after the InkOverlay encounters any other cursor, such as a pen. This is because the pen also acts like a mouse.

Note

The CursorInRange event is received for the mouse cursor after any other cursor, such as when a pen draws a stroke (which fires the Stroke event).

The Cursors collection is cleared (count set to 0, containing no objects) when:

  • The tablet mode is changed (for example, from SetSingleTabletIntegratedMode to SetAllTabletsMode).

  • The SetSingleTabletIntegratedMode method is called.

Example

This C# example returns a report on the attributes of all of the cursors seen by the InkOverlay object passed in as a parameter.

using Microsoft.Ink;
//. . .
public string CursorReport(InkOverlay theInkOverlay)
{
    string theReport = "The InkOverlay has encountered the following cursors so far:" + Environment.NewLine;
    // Get the Cursors collection from the InkOverlay
    Microsoft.Ink.Cursors theCursors = theInkOverlay.Cursors;
    // Prevent changes to the collection while we iterate over it.
    lock( theCursors.SyncRoot )
    {
        theReport += "Count of cursors: " + theCursors.Count + Environment.NewLine + Environment.NewLine ;
        foreach (Microsoft.Ink.Cursor cursor in theCursors)
        {
            theReport += "Cursor Name: " + cursor.Name + Environment.NewLine;
            theReport += "Cursor ToString: " + cursor.ToString() + Environment.NewLine;
            theReport += "Tablet Name: " + cursor.Tablet.Name  + Environment.NewLine;
            theReport += "Cursor Id: " + cursor.Id.ToString()  + Environment.NewLine;
            theReport += "Cursor is inverted: " + cursor.Inverted.ToString()  + Environment.NewLine;
            theReport += "Cursor Buttons:" + Environment.NewLine;
            foreach (CursorButton button in cursor.Buttons)
            {
                CursorButtonState theState = button.State;
                theReport += "    Button Name: " + button.Name + Environment.NewLine;
                theReport += "    State: " + button.State.ToString() + Environment.NewLine;
                theReport += "    Id: " + button.Id.ToString()  + Environment.NewLine + Environment.NewLine;
            }
        }
    }
    return theReport;
}

This Microsoft Visual Basic .NET example returns a report on the attributes of all of the cursors seen by the InkOverlay object passed in as a parameter.

Imports Microsoft.Ink
'. . .
Public Function CursorReport(ByVal theInkOverlay As InkOverlay) _
    As String
    Dim theReport As String = "The InkOverlay has encountered " & _
        "the following cursors so far:" & vbCrLf
    ' Get the Cursors collection from the InkOverlay
    Dim theCursors As Cursors = theInkOverlay.Cursors
    ' Prevent changes to the collection while we iterate over it.
    SyncLock theCursors.SyncRoot
        theReport &= "Count of cursors: " & theCursors.Count & vbCrLf
        Dim theCursor As Cursor
        For Each theCursor In theCursors
            theReport &= "Cursor Name: " & theCursor.Name & vbCrLf
            theReport &= "Cursor ToString: " & theCursor.ToString() & _
                vbCrLf
            theReport &= "Tablet Name: " & theCursor.Tablet.Name & vbCrLf
            theReport &= "Cursor Id: " & theCursor.Id.ToString() & vbCrLf
            theReport &= "Cursor is inverted: " & _
                theCursor.Inverted.ToString() & vbCrLf
            theReport &= "Cursor Buttons:" & vbCrLf
            Dim theButton As CursorButton
            For Each theButton In theCursor.Buttons
                Dim theState As CursorButtonState = theButton.State
                theReport &= "    Button Name: " & theButton.Name & vbCrLf
                theReport &= "    State: " & _
                    theButton.State.ToString() & vbCrLf
                theReport &= "    Id: " & theButton.Id.ToString() & _
                    vbCrLf & vbCrLf
            Next
        Next
    End SyncLock
    Return theReport
End Function

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkOverlay Class
InkOverlay Members
Microsoft.Ink Namespace
Cursors
Cursor
InkOverlay.SetSingleTabletIntegratedMode
Microsoft.Ink.InkOverlay.SetAllTabletsMode