Search
Alignment Grid

NetDiagram provides an alignment grid to help users place diagram items more precisely. To activate the grid, set the AlignToGrid property to true. If the grid is active while creating or modifying an item, the item's control-points are aligned to the nearest grid points. The GridSizeX and GridSizeY properties set the distance between adjacent grid points. 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 AlignPointToGrid to place items exactly at grid points.

The grid can be either visible or invisible, depending on whether the ShowGrid value is true or false. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified in the GridStyle property. GridColor defines the color for painting the alignment points or lines.