Alignment Grid

MindFusion.Diagramming provides an alignment grid to help users place the diagram items more precisely. To activate the grid, set the alignToGrid property to true. If the grid is active while an item is being created or modified, the item’s control-points are aligned to the nearest grid points. The distance between adjacent grid points is set by the gridSizeX and gridSizeY properties. The gridOffsetX and gridOffsetY properties allow specifying the horizontal and vertical offset of the first point in the alignment grid.

Items created or modified by a user are automatically aligned to the grid. However, if items are placed in the diagram programmatically, their coordinates are set to the specified positions without aligning. In such cases use the alignPointToGrid(...) method if items must be placed exactly at grid points.

The grid can be either visible or invisible, depending on whether the showGrid property is enabled. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified by the gridStyle property. gridColor defines the color with which the alignment points or lines are painted.