Divider.Divide 方法

返回一个包含 Divider 对象的 Strokes 属性的结构信息的 DivisionResult 对象。

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

语法

声明
Public Function Divide As DivisionResult
用法
Dim instance As Divider
Dim returnValue As DivisionResult

returnValue = instance.Divide()
public DivisionResult Divide()
public:
DivisionResult^ Divide()
public DivisionResult Divide()
public function Divide() : DivisionResult

返回值

类型:Microsoft.Ink.DivisionResult
返回一个包含 Divider 对象的 Strokes 属性的结构信息的 DivisionResult 对象。

备注

每次调用此方法均会返回一个新的 DivisionResult 对象。

Divide 方法的返回值在 Divider 对象的 Strokes 属性中存储布局分析 的结果。

示例

此 C# 示例创建一个 Divider 对象 theDivider,该对象包含 Strokes 集合 theStrokes,并使用 RecognizerContext 对象 theRecognizerContext。将调用 Divide 方法以获取分析结果 theResult 的快照。将调用 ResultByType 方法,调用时将 divisionType 参数设置为一个 InkDivisionType 枚举 Line,以检索 theResult 中的所有行单元。对于 Strokes 集合中的每一行 theLine,均会检索 DivisionUnit.DivisionTypeDivisionUnit.StrokesDivisionUnit.RecognitionStringDivisionUnit.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;
}

此 Visual Basic .NET 示例创建一个 Divider 对象 theDivider,该对象包含 Strokes 集合 theStrokes,并使用 RecognizerContext 对象 theRecognizerContext。Divide 方法返回分析结果的快照 theResult。将调用 ResultByType 方法,调用时将 divisionType 参数设置为一个 InkDivisionType 枚举 Line,以检索 theResult 中的所有行单元。对于 Strokes 集合中的每一行 theLine,均会检索 DivisionUnit.DivisionTypeDivisionUnit.StrokesDivisionUnit.RecognitionStringDivisionUnit.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

另请参见

参考

Divider 类

Divider 成员

Microsoft.Ink 命名空间

InkDivisionType

DivisionUnit

DivisionUnits