Moving or drawing annotation objects do not snap to nearest grid point.

bShowGrid

Flag that indicates whether or not do display the grid in design mode. Possible values are:

Value

Meaning

TRUE

Display the grid design mode.

FALSE

Do not display the grid.

bAutoChangeGridLength

Flag that indicates whether or not to atomically increase the resolution of the grid when zooming in by 100%, 200%, 400% and so on:

Value

Meaning

TRUE

If possible, automatically increase the resolution of the grid when zooming.

FALSE

Do not automatically increase the resolution of the grid when zooming.

nReserved

Reserved for future use. Must be set to zero.

Comments

The ANNSNAPTOGRIDOPTIONS structure is used with the functions L_AnnSetSnapToGrid and L_AnnGetSnapToGrid to get or set the annotation snap to grid behavior in annotation automation design mode. When calling the L_AnnGetSnapToGrid function, the uFlags field identifies which fields to retrieve. When calling the L_AnnSetSnapToGrid function, the uFlags field identifies which fields to set.

The snap-to-grid feature is used in annotation automation design mode to allow the user to precisely draw, locate, and align annotation objects. When snap-to-grid is enabled (see L_AnnSetSnapToGrid), a grid pattern consisting of dots and lines is overlayed on the image. When creating annotations in design mode, each point snaps to the nearest grid point. This beavior holds for creating any annotation object EXCEPT the freehand annotation. When creating a freehand annotation, the individual points do NOT snap to the nearest grid point because this would adversely affect the behavior of the freehand. The snap-to-grid feature affects the moving of all annotations object types in design mode, in that the bounding box of the annotation object snaps to the nearest grid point.

The grid that is overlayed can be customized by color (see crGridColor), grid spacing (see uGridLength), and line frequency (see uLineSpacing). For example, to display a red grid that has a dot pattern every 20 pixels, and solid lines every 100 pixels, you would set:

The lines of the grid can be removed completely by setting uLineStyle to be ANNLINE_NULL. The lines of the grid can be drawn in any style (see uLineStyle). The grid itself can be hidden (see bShowGrid) so that the snap-to-grid feature is still on without the grid being overlaid on the image. Conversely, the grid can be displayed (see bShowGrid) while disabling the snap-to-grid-behavior (see the L_AnnSetSnapToGrid function).

Setting bAutoChangeGridLength to TRUE affects the grid density when zooming. The effect is that when zooming to 200%, the density of the dot pattern doubles. When zooming to 400%, the density doubles again. The density doubles at 200%, 400%, 800%, 1600% and so on as long as it is meaningful to double the density. In other words, if doubling the dot density would create a dot where no pixel exists when viewing at 100%, then the dot density will not change. The following examples illustrate this.

Example 1: uGridLength is 10
The dot density doubles at 200% because 10 is evenly divisible by 2.
The dot density does not double again at 400% because 10 do not evenly divide 4.

Example 2: uGridLength is 20
The dot density doubles at 200%, and doubles again at 400%.
The dot density does not double again at 800% because 20 does not divide 8 evenly.

Example 3: uGridLength is 21
The dot density never changes because 21 is a prime number.

The snap-to-grid behavior can be turned on our off in annotation automation mode by right-clicking on a part of the image that does not contain an annotation, and selecting the Snap To Grid option from the pop up menu. The snap-to-grid behavior can be customized in annotation automation mode by

right-clicking on a part of the image that does not contain an annotation

selecting Default Properties

clicking on the "Snap to Grid..." menu option

Example

This sample:

gets the current state of the snap-to-grid

changes the snap to grid to grid size of 10, lines every ten row of dots, solid red lines