InkPicture.Cursors 属性

获取可以在墨迹区域中使用的 Cursors 集合。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
<BrowsableAttribute(False)> _
Public ReadOnly Property Cursors As Cursors
用法
Dim instance As InkPicture
Dim value As Cursors

value = instance.Cursors
[BrowsableAttribute(false)]
public Cursors Cursors { get; }
[BrowsableAttribute(false)]
public:
property Cursors^ Cursors {
    Cursors^ get ();
}
/** @property */
/** @attribute BrowsableAttribute(false) */
public Cursors get_Cursors()
public function get Cursors () : Cursors

属性值

类型:Microsoft.Ink.Cursors
可以在墨迹区域中使用的 Cursors 集合。

备注

每个光标都对应于笔尖或其他墨迹 输入设备。

对于 InkPicture 控件,此集合中的光标是局部的。

InkPicture 控件遇到的任何新光标都将添加到返回的 Cursors 集合中,但可能不以 InkPicture 控件遇到光标的顺序返回光标。

如果启用鼠标作为 InkPicture 控件的输入设备(SetAllTabletsMode 方法的 useMouseForInput 参数为 true),在 InkPicture 遇到任何其他光标(如笔)之后,会将鼠标添加到 Cursors 集合中。这是因为笔的行为类似于鼠标。

备注

如果在任何其他光标之后遇到鼠标光标,如用笔绘制笔画时(将激发 Stroke 事件),将接收到 CursorInRange 事件。

在以下情况下,将清除 Cursors 集合(计数设置为 0,不包含任何对象):

示例

此 C# 示例返回一份报告,其中列出了在参数 theInkPicture 中传入的 InkPicture 控件所看到的所有光标的属性。

[C#]

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

此 Microsoft(R) Visual Basic(R) .NET 示例返回一份报告,其中列出了在参数 theInkPicture 中传入的 InkPicture 控件所看到的所有光标的属性。

[Visual Basic]

Imports Microsoft.Ink
'. . .
Public Function CursorReport(ByVal theInkPicture As InkPicture) _
    As String
    Dim theReport As String = "The InkPicture has encountered " & _
        "the following cursors so far:" & vbCrLf
    ' Get the Cursors collection from the InkPicture
    Dim theCursors As Cursors = theInkPicture.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

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkPicture 类

InkPicture 成员

Microsoft.Ink 命名空间

InkPicture

Cursors

InkPicture.SetAllTabletsMode

InkPicture.SetSingleTabletIntegratedMode