DivisionResult.ResultByType 方法
获取 DivisionUnits 集合中的请求的分析结果结构单元。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Function ResultByType ( _
divisionType As InkDivisionType _
) As DivisionUnits
用法
Dim instance As DivisionResult
Dim divisionType As InkDivisionType
Dim returnValue As DivisionUnits
returnValue = instance.ResultByType(divisionType)
public DivisionUnits ResultByType(
InkDivisionType divisionType
)
public:
DivisionUnits^ ResultByType(
InkDivisionType divisionType
)
public DivisionUnits ResultByType(
InkDivisionType divisionType
)
public function ResultByType(
divisionType : InkDivisionType
) : DivisionUnits
参数
- divisionType
类型:Microsoft.Ink.InkDivisionType
InkDivisionType 枚举值之一,指示要返回的结构单元。
返回值
类型:Microsoft.Ink.DivisionUnits
返回包含请求的分析结果结构单元的 DivisionUnits 集合。
备注
每次调用此方法均会返回一个新的 DivisionUnits 集合。
如果 DivisionResult 对象中没有请求的类型的结构单元,则此方法返回一个空 DivisionUnits 集合。
示例
此 C# 示例创建一个 Divider 对象 theDivider,该对象包含 Strokes 集合 theStrokes,并使用 RecognizerContext 对象 theRecognizerContext。将调用 Divide 方法以获取分析结果 theResult 的快照。将调用 ResultByType 方法,调用时将 divisionType 参数设置为 InkDivisionType,以检索 theResult 中的所有行单元。对于 Strokes 集合中的每一行 theLine,均会检索 DivisionUnit.DivisionType、DivisionUnit.Strokes、DivisionUnit.RecognitionString 和 DivisionUnit.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,以检索 theResult 中的所有行单元。对于 Strokes 集合中的每一行 theLine,均会检索 DivisionUnit.DivisionType、DivisionUnit.Strokes、DivisionUnit.RecognitionString 和 DivisionUnit.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