次の方法で共有


Cursor.Buttons プロパティ

既知の Cursor で使用可能な CursorButtons コレクションを取得します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public ReadOnly Property Buttons As CursorButtons
'使用
Dim instance As Cursor
Dim value As CursorButtons

value = instance.Buttons
public CursorButtons Buttons { get; }
public:
property CursorButtons^ Buttons {
    CursorButtons^ get ();
}
/** @property */
public CursorButtons get_Buttons()
public function get Buttons () : CursorButtons

プロパティ値

型 : Microsoft.Ink.CursorButtons
既知の Cursor で使用可能な CursorButtons コレクション。

解説

ペンの場合、ボタンは手書きの先端、消しゴムの先端、および胴体ボタンを含むことができます。

ms581964.alert_note(ja-jp,VS.90).gifメモ :

この関数は、特定のメッセージ ハンドラ内で呼び出されると再入力されるため、予期しない結果が発生する可能性があります。WM_ACTIVATEWM_ACTIVATEAPPWM_NCACTIVATEWM_PAINT、wParam が SC_HOTKEY または SC_TASKLIST に設定されている場合のWM_SYSCOMMAND および WM_SYSKEYDOWN (Alt-Tab キーまたは Alt-Esc キーの組み合わせで処理される場合) のいずれかのメッセージを処理するときは、再入呼び出しを回避するように注意してください。これはシングル スレッド アパートメント モデル アプリケーションに関する問題です。

この C# の例では、パラメータとして渡された InkCollector オブジェクトによって検出されたすべてのカーソルの属性に関するレポートを返します。

using Microsoft.Ink;
//. . .
public string CursorReport(InkCollector theInkCollector)
{
    string theReport = "The InkCollector has encountered the following cursors so far:" + Environment.NewLine;
    // Get the Cursors collection from the InkCollector
    Microsoft.Ink.Cursors theCursors = theInkCollector.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;
}

この Microsoft® Visual Basic® .NET の例では、パラメータとして渡された InkCollector オブジェクトによって検出されたすべてのカーソルの属性に関するレポートを返します。

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

参照

参照

Cursor クラス

Cursor メンバ

Microsoft.Ink 名前空間

CursorButton

CursorButtons