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 集合。這是因為畫筆也可以做為滑鼠使用。
![]() |
---|
在任何其他游標之後的滑鼠游標會收到 CursorInRange 事件,例如,當畫筆繪製筆劃 (會引發 Stroke 事件) 時。 |
在下列情況下,會清除 Cursors 集合 (計數設定為 0,不包含任何物件):
手寫板模式已變更 (例如,從 SetSingleTabletIntegratedMode 變更為 SetAllTabletsMode)。
範例
這個 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® Visual Basic® .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