Compartir a través de


DivisionUnit.Transform Property

Gets the transformation matrix that the DivisionUnit object uses to rotate the strokes to horizontal.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public ReadOnly Property Transform As Matrix
'Usage
Dim instance As DivisionUnit
Dim value As Matrix

value = instance.Transform
public Matrix Transform { get; }
public:
property Matrix^ Transform {
    Matrix^ get ();
}
/** @property */
public Matrix get_Transform ()
public function get Transform () : Matrix
Not applicable.

Property Value

The transformation matrix that the DivisionUnit object uses to rotate the strokes to horizontal.

Remarks

Text recognizers perform best with horizontal handwriting. Apply this transformation to the Strokes property of the DivisionUnit object before passing the strokes to a RecognizerContext object.

The point of rotation of the matrix is set to the lower-left corner of the line's bounding box for both segments and lines. The rotation angle for a recognition segment is the same as that of the line that contains the segment.

Note

For a DivisionUnit object which represents a paragraph or drawing, this property returns the identity matrix.

Use this property to level handwriting or to accurately draw lines or shapes around angled handwriting.

Example

This C# example creates a Divider object, theDivider, which contains a Strokes collection, theStrokes, and uses a RecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results, theResult. The ResultByType method is called with the divisionType parameter set to Line, a InkDivisionType enumeration, to retrieve all of the line units within theResult. For each line, theLine, in the collection, the DivisionType, Strokes, RecognitionString, and Transform properties are retrieved.

// 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;
}

This Microsoft® Visual Basic® .NET example creates a Divider object, theDivider, which contains a Strokes collection, theStrokes, and uses a RecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results, theResult. The ResultByType method is called with the divisionType parameter set to Line, a InkDivisionType enumeration, to retrieve all of the line units within theResult. For each line, theLine, in the collection, the DivisionType, Strokes, RecognitionString, and Transform properties are retrieved.

' 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

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DivisionUnit Class
DivisionUnit Members
Microsoft.Ink Namespace
DivisionUnit.Strokes
BoundingBoxMode
RecognizerContext

Other Resources

System.Drawing.Drawing2D.Matrix