LEADTOOLS Annotations Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.22
Fixed Annotations

Most annotation objects can be "fixed". When an annotation is 'fixed', it gets drawn using a default annotation container transform. The container transform is manipulated using the AnnContainer.Transform property.

Changing the container transform is primarily used for scrolling and zooming annotations on an image.

The effect of fixing an annotation is that it is frozen on the container. Zooming and scrolling will move the underlying image and non-fixed annotations, but fixed annotations will not move. The annotation can still be moved by selecting and dragging the annotation with the mouse.

A fixed annotation object could be desireable in certain situation, for example, if you do not want the thickness of a line object to grow larger or smaller when the container is zoomed in and out, you set its fixed state to PenWidth. If you have a ruler object and you do not want the thickness of its line nor the size of its font to change when the container zoomes in and out, you set its fixed state to FontSize | PenWidth.

Fixing an annotation is easily accomplished using automation. Right-click the annotation, select the Fixed menu item.

With code, fixing an annotation is performed with two properties of the Leadtools.Annotations.AnnObject class:

Property Description
AnnObject.SetFixedState and AnnObject.GetFixedState.

Methods useds to fix the object position for scrolling. If you pass false, the object is not fixed and will move when the container is scrolled, if you pass true, the object is fixed and will not move when the container is scrolled.

AnnObject.FixedState

One or more combination of the Leadtools.Annotations.AnnFixedStateOperations enumeration members to determine if the object size is fixed and whether it should scales up and down when the container is zoomed in or out.

For AnnObject.FixedState, you need to set this property to one or more of the members of the Leadtools.Annotations.AnnFixedStateOperations enumeration to achieve fixed-size objects. By default, the value of this property is AnnFixedStateOperations.None, which means the object is not fixed and will zoom and scroll whenever the container zooms and scrolls.

To fix an object, you set its AnnObject.FixedState property to other than None as described in the following table:

Member Description
AnnFixedStateOperations.None

The object is not fixed and will scale up and down when the container zooms in and out. This is the default behavior.

AnnFixedStateOperations.FontSize

Use this to prevent the size of any text in the annotation object from changing if the container is zoomed in or out. For example, the AnnRulerObject contains text for the length value, it may be desirable to prevent the text size of the length from changing if the container is zoomed in and out. If you set the font size of this ruler to 9 points and use this member in the AnnObject.FixedState property, then the font size of the ruler text will always be 9 points regardless of how much the container is zoomed in or out.

AnnFixedStateOperations.PenWidth

Use this to prevent the width of the pen used to draw an annotation object from getting thicker or thinner when the container is zoomed in or out. Setting this property will effect all parts of an annotation object.

By combining AnnObject.SetFixedState with AnnObject.FixedState you can create all various combinations needed for fixing an annotation object in its container.