LEADTOOLS Annotations (Leadtools.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Transform Property
See Also 
Leadtools.Annotations Namespace > AnnObject Class : Transform Property



The Transform Property is available in LEADTOOLS Document and Medical Imaging toolkits.

Returns the current transformation System.Drawing.Drawing2D.Matrix of this AnnObject.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Transform As Matrix
Visual Basic (Usage)Copy Code
Dim instance As AnnObject
Dim value As Matrix
 
value = instance.Transform
C# 
public Matrix Transform {get;}
C++/CLI 
public:
property Matrix^ Transform {
   Matrix^ get();
}

Property Value

The current transformation System.Drawing.Drawing2D.Matrix of this AnnObject.

Example

This example will perform various transformation on an annotation object then shows its transformation matrix.

Visual BasicCopy Code
Private Sub AnnObject_Transform(ByVal obj As AnnObject)
   ' show the matrix
   ShowMatrix(obj.Transform)
   obj.Translate(2, 3)
   ShowMatrix(obj.Transform)
   obj.Scale(1.5F, 1.5F, obj.Origin)
   ShowMatrix(obj.Transform)
   obj.Rotate(45, obj.Origin)
   ShowMatrix(obj.Transform)
   obj.ResetTransform()
   ShowMatrix(obj.Transform)
End Sub

Private Sub ShowMatrix(ByVal mat As Matrix)
   Dim index As Integer = 0
   For i As Integer = 0 To 2
      For j As Integer = 0 To 1
         Console.Write("{0}, ", mat.Elements(index))
         index += 1
      Next j

      If i = 2 Then
         Console.WriteLine("{0}", "1")
      Else
         Console.WriteLine("{0}", "0")
      End If
      Console.WriteLine("---------")
   Next i
End Sub
C#Copy Code
private void AnnObject_Transform(AnnObject obj)
{
   // show the matrix
   ShowMatrix(obj.Transform);
   obj.Translate(2, 3);
   ShowMatrix(obj.Transform);
   obj.Scale(1.5F, 1.5F, obj.Origin);
   ShowMatrix(obj.Transform);
   obj.Rotate(45, obj.Origin);
   ShowMatrix(obj.Transform);
   obj.ResetTransform();
   ShowMatrix(obj.Transform);
}

private void ShowMatrix(Matrix mat)
{
   int index = 0;
   for(int i = 0; i < 3; i++)
   {
      for(int j = 0; j < 2; j++)
         Console.Write("{0}, ", mat.Elements[index++]);

      Console.WriteLine("{0}", i == 2 ? "1" : "0");
      Console.WriteLine("---------");
   }
}

Remarks

(Read only) Each annotation object has a transformation matrix associated with it. You can perform various operations on this matrix by calling AnnObject.ResetTransform, AnnObject.Translate, AnnObject.Scale and AnnObject.Rotate.

Derived annotation objects can control the transformation operation by overriding the TransformObjectMode property.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features