共用方式為


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 參數設定為 Line (即 InkDivisionType 列舉型別),以擷取 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® Visual Basic® .NET 範例會建立 Divider 物件 theDivider (其中包含 Strokes 集合 theStrokes),並且使用 RecognizerContext 物件 theRecognizerContext。它會呼叫 Divide 方法,以取得分析結果 theResult 的快照。呼叫 ResultByType 方法時會將 divisionType 參數設定為 Line (即 InkDivisionType 列舉型別),以擷取 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