次の方法で共有


StylusButtons.Count プロパティ

スタイラスのボタンの数を取得します。

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

構文

'宣言
Public ReadOnly Property Count As Integer
'使用
Dim instance As StylusButtons
Dim value As Integer

value = instance.Count
public int Count { get; }
public:
property int Count {
    int get ();
}
/** @property */
public int get_Count()
public function get Count () : int

プロパティ値

型 : System.Int32
スタイラスのボタンの数。

解説

このコレクションで定義されるボタンの一覧は、デジタイザによってサポートされるボタンを示します。必ずしもペン上にあるボタンではありません。プラグインが StylusButtonDown 通知と StylusButtonUp 通知を受け取ると、特定のスタイラス ボタンの状態とその存在を確認できます。

この Microsoft Visual C# .NET の例では、フォームに実装された StylusInRange メソッドのイベント ハンドラを示します。

public class Form1 : Form, IStylusAsyncPlugin
{
    private RealTimeStylus rts;
    private DynamicRenderer dr;
    private System.Windows.Forms.TextBox textBox1;
    public Form1()
    {
        rts = new RealTimeStylus(this);
        dr = new DynamicRenderer(this);
        rts.SyncPluginCollection.Add(dr);
        rts.AsyncPluginCollection.Add(this);
        rts.Enabled = true;
        dr.Enabled = true;

        InitializeComponent();
    }
    // ...
    public Microsoft.StylusInput.DataInterestMask DataInterest
    {
        get{return DataInterestMask.AllStylusData;}
    }
    public void StylusInRange(RealTimeStylus sender, StylusInRangeData data)
    {
        string sInverted = data.Stylus.Inverted ? "is inverted" : "is not inverted";
        
        textBox1.AppendText(
            string.Format("{0} in range; {1}; has {2} buttons:{3}", 
                data.Stylus.Name, 
                sInverted,
                data.Stylus.Buttons.Count,
                Environment.NewLine)
            );

        for (int i=0; i<data.Stylus.Buttons.Count; i++)
        {
            textBox1.AppendText(
                string.Format("    {0}: {1}{2}", 
                    i.ToString(),
                    data.Stylus.Buttons.GetName(i),
                    Environment.NewLine)
                );
        }
    }
    // ...

プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

StylusButtons クラス

StylusButtons メンバ

Microsoft.StylusInput 名前空間

Microsoft.StylusInput.PluginData.StylusButtonDataBase

Microsoft.StylusInput.PluginData.StylusButtonDownData

Microsoft.StylusInput.PluginData.StylusButtonUpData