DivisionUnit.RecognitionString 属性

获取 DivisionUnit 对象中 Strokes 集合的已识别文本

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

语法

声明
Public ReadOnly Property RecognitionString As String
用法
Dim instance As DivisionUnit
Dim value As String

value = instance.RecognitionString
public string RecognitionString { get; }
public:
property String^ RecognitionString {
    String^ get ();
}
/** @property */
public String get_RecognitionString()
public function get RecognitionString () : String

属性值

类型:System.String
DivisionUnit 对象中 Strokes 集合的已识别文本

备注

RecognitionString 属性对于绘制元素返回 null。

下表描述了每种类型 DivisionUnit 对象的已识别文本。

DivisionUnit 类型

RecognitionString 值

Segment

识别段的最佳备选项。

Line

行中每个识别段的 RecognizedText,由空格分隔。

Paragraph

段落中每一行的 RecognizedText,由换行符分隔。

Drawing

nullnull 引用(在 Visual Basic 中为 Nothing)

RecognitionString 属性与 DivisionUnit.ToString 方法返回相同的字符串。

示例

此 C# 示例创建一个 Divider 对象 theDivider,该对象包含 Strokes 集合 theStrokes,并使用 RecognizerContext 对象 theRecognizerContext。将调用 Divide 方法以获取分析结果 theResult 的快照。将调用 ResultByType 方法,调用时将 divisionType 参数设置为一个 InkDivisionType 枚举 Line,以检索 theResult 中的所有行单元。对于集合中的每一行 theLine,将检索 DivisionTypeStrokes、RecognitionString 和 Transform 属性。

// Create the Divider and assign a Strokes collection to it.
Divider theDivider = new Divider(theStrokes, theRecognizerContext);

// Retrieve the analysis result, and divide the result by line.
DivisionResult theResult = theDivider.Divide();
DivisionUnits theDivisionUnits =
    theResult.ResultByType(InkDivisionType.Line);
foreach (DivisionUnit theLine in theDivisionUnits)
{
    // For each line element in the collection
    // retrieve the division type, the strokes,
    // the recognition string, and the rotation transform.
    InkDivisionType theDivisionType = theLine.DivisionType;
    Strokes elementStrokes = theLine.Strokes;
    string theRecognitionString = theLine.RecognitionString;
    System.Drawing.Drawing2D.Matrix theInkTransform =
        theLine.Transform;
}

此 Microsoft(R) Visual Basic(R) .NET 示例创建一个 Divider 对象 theDivider,该对象包含 Strokes 集合 theStrokes,并使用 RecognizerContext 对象 theRecognizerContext。将调用 Divide 方法以获取分析结果 theResult 的快照。将调用 ResultByType 方法,调用时将 divisionType 参数设置为一个 InkDivisionType 枚举 Line,以检索 theResult 中的所有行单元。对于集合中的每一行 theLine,将检索 DivisionTypeStrokes、RecognitionString 和 Transform 属性。

' Create the Divider and assign a Strokes collection to it.
Dim theDivider As Divider = New Divider(theStrokes, theRecognizerContext)

' Retrieve the analysis result, and divide the result by line.
Dim theResult As DivisionResult = theDivider.Divide()
Dim theDivisionUnits As DivisionUnits = _
    theResult.ResultByType(InkDivisionType.Line)
Dim theLine As DivisionUnit
For Each theLine In theDivisionUnits
    ' For each line element in the collection
    ' retrieve the division type, the strokes,
    ' the recognition string, and the rotation transform.
    Dim theDivisionType As InkDivisionType = theLine.DivisionType
    Dim elementStrokes As Strokes = theLine.Strokes
    Dim theRecognitionString As String = theLine.RecognitionString
    Dim theInkTransform As System.Drawing.Drawing2D.Matrix = _
        theLine.Transform
Next

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

DivisionUnit 类

DivisionUnit 成员

Microsoft.Ink 命名空间

DivisionUnit.DivisionType

DivisionUnit.ToString

Strokes