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® Visual Basic® .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