GestureRecognitionData.Count 属性

获取对于笔势所存在的识别备选项的数目。

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

语法

声明
Public ReadOnly Property Count As Integer
用法
Dim instance As GestureRecognitionData
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
对于笔势所存在的识别备选项的数目。

示例

此 Microsoft Visual C# .NET 示例是 IStylusAsyncPlugin 接口的 CustomStylusDataAdded 方法实现中的代码段。实现 IStylusAsyncPlugin 接口的窗体包含一个 TextBox 对象 theTextBox。CustomStylusDataAdded 方法检查来自 GestureRecognizer 对象的自定义手写笔数据,并显示有关 GestureRecognizer 对象所识别的任何笔势的信息。

using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;

// ...

// Declare the RealTimeStylus objects, the GestureRecognizer plugin,
// and the DynamicRenderer plug-in.
private Microsoft.StylusInput.RealTimeStylus thePrimaryRealTimeStylus = null;
private Microsoft.StylusInput.RealTimeStylus theSecondaryRealTimeStylus = null;
private Microsoft.StylusInput.GestureRecognizer theGestureRecognizer = null;
private Microsoft.StylusInput.DynamicRenderer theDynamicRenderer = null;

// ...

// Informs the implementing object that user data is available.
public void CustomStylusDataAdded(RealTimeStylus sender, CustomStylusData data)
{
    // We can identify the kind of custom data via either the Guid or Type.
    // For the purpose of this demonstration we will validate both just to be safe.
    // For other scenarios either approach is valid.
    if (data.CustomDataId == GestureRecognizer.GestureRecognitionDataGuid)
    {
        // Cast the custom stylus data to gesture recognition data.
        GestureRecognitionData theData = data.Data as GestureRecognitionData;

        // If there is data in the notification, then display the information
        // for all of the gestures recognized.
        if (theData != null && theData.Count > 0)
        {
            this.theTextBox.Text = "GestureRecognitionData:" + Environment.NewLine;
            foreach (GestureAlternate theGesture in theData)
            {
                this.theTextBox.Text += string.Format(
                    "  Gesture {0,-10}, Confidence {1,-8}, Count {2}."
                    + Environment.NewLine, theGesture.Id,
                    theGesture.Confidence, theGesture.StrokeCount);
            }
            this.theTextBox.Text += Environment.NewLine;
        }
    }
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

GestureRecognitionData 类

GestureRecognitionData 成员

Microsoft.StylusInput.PluginData 命名空间