function Leadtools.Annotations.Core.AnnSnapToGridOptions()
The AnnSnapToGridOptions class is used with the SnapToGridOptions property to get or set the annotation snap to grid behavior in annotation automation design mode. You can then enable or disable snapping to grid by using the EnableSnap property, also you can control showing or hiding snap grid using ShowGrid property.
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 (EnableSnap is set to true) and the property ShowGrid is set to true, a grid pattern consisting of dots and lines is overlayed on the image being annotated. When creating annotations in design mode, each point snaps to the nearest grid point. This behavior 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 (GridStroke), grid spacing (GridLength), and line frequency (LineSpacing). For example, to display a red grid that has a dot pattern every 30 pixels, you would set:
GridStroke.Stroke = AnnSolidColorBrush.Create("red")
LineSpacing = 30
The lines of the grid can be drawn in any style (AnnStroke). The grid itself can be hidden by setting ShowGrid to false. so that the snap-to-grid feature is still on without the grid being overlaid on the image. Conversely, the grid can be displayed by setting ShowGrid to true while disabling the snap-to-grid-behavior by setting EnableSnap to false.