Using Text in WPF Annotation Objects

Many annotation objects utilize text as part of the annotation.

The IAnnText interface provides a set of properties that are common to text and are utilized by any class of annotation object that utilizes text. This interface is implemented by several of The WPF annotation Object classes provided by LEADTOOLS. These include:

AnnButtonObject

AnnGroupObject

AnnNoteObject

AnnStampObject

AnnTextObject

AnnTextPointerObject

AnnTextRollupObject

AnnRichTextObject

Each of these classes except the rich text object (either through the direct implementation of IAnnText or inheritance from the AnnTextObject class which implements the IAnnText interface) accesses properties that control vertical and horizontal alignment, margin width and the actual text. The TextHorizontalAlignment and TextVerticalAlignment properties control the horizontal and vertical alignment of the text. The TextEdgeMargin property controls the distance between the text and the bounding rectangle of the text.

AnnTextObject:

The AnnTextObject class implements the IAnnText interface and accesses the common text properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObject, and AnnRectangleObject classes. The AnnTextObject class expands on these inherited classes with several properties and methods. The Clone method makes an exact copy of the AnnTextObject class object that calls it, while the Create method just creates a new AnnTextObject class object.

Like the AnnTextObject class, the AnnGroupObject class implements the IAnnText interface. The AnnButtonObject, AnnNoteObject, AnnStampObject, AnnTextPointerObject, and AnnTextRollupObject classes all inherit the AnnTextObject class and access the common text properties mentioned above through this inheritance.

AnnTextPointerObject

The AnnTextPointerObject class inherits the AnnTextObject and accesses the common text properties mentioned above through this inheritance. This class also inherits numerous properties and methods from the Object, AnnObject, and AnnRectangleObject classes. In addition, the AnnTextPointerObject class extends the functionality of the AnnTextObject class by providing an extra line that starts from one of the four corners of the bounding rectangle, around the text. The other endpoint of the line can be moved to point to anything on the underlying image. This extra endpoint may or may not be fixed. The bounding rectangle is given in the Rect property. The position of this extra endpoint is given in the PointerPosition property. The FixedPointer property indicates whether this endpoint is fixed.

If the endpoint is fixed, then transforming the bounding rectangle of the text will not change the location of this endpoint. If the endpoint is not fixed, then the location of the endpoint will change as the bounding rectangle of the text is transformed. The TransformMode property indicates how the transformation process of the object will be performed.

The AnnTextPointerObject class further expands on these inherited classes with several methods. The Clone method makes an exact copy of the AnnTextPointerObject class object that calls it, while the Create method just creates a new AnnTextPointerObject class object. The DefiningGeometry property returns a Geometry representation of the text pointer annotation object.

When transforming a text pointer object, the GetTransformPoints method gets the array of points to be transformed. Once those points have been transformed, they can be set back in the text pointer object by calling the SetTransformPoints method.

AnnTextRollupObject

The AnnTextRollupObject class inherits the AnnTextObject and accesses the common text properties mentioned above through this inheritance. This class also inherits numerous properties and methods from the Object, AnnObject, and AnnNoteObject classes In addition, the AnnTextRollupObject class extends the functionality of the AnnTextObject class by looking and behaving just like a note object, or being compacted to only display the first line of text. This is done using the Expanded property. If the Expanded property is true, then the text rollup object is expanded, looking and behaving like a Note annotation object. If the IsExpanded property is false, the text rollup object is compacted, or rolled up, to display only one line of text.

The AnnTextRollupObject class further expands on the inherited classes with several methods. The Clone method makes an exact copy of the AnnTextRollupObject class object that calls it, while the Create method just creates a new AnnTextRollupObject class object. For more information on rich text objects, refer to AnnRichTextObject

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document
Click or drag to resize