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
手写笔上的按钮数。

备注

该集合中提供的按钮列表指示数字化仪支持、但不一定出现在笔上的按钮。当插件收到 StylusButtonDownStylusButtonUp 通知时,您可以确定特定手写笔按钮的状态,并确认其是否存在。

示例

此 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