Diagram / Diagram DOM / Drawings / Pages / Grid and Rulers
In This Topic
    Grid and Rulers
    In This Topic
     About Grid and Rulers

    The grid and rulers settings of each page are exposed by the NGrid and NRulers elements, which are accessible from the Grid and Rulers properties of each NPage. Because the grid and rulers have many common aspects, the NGrid and NRulers classes derive from the base NGridRulersBase class that defines most of their common features.

    The grid and rulers are designed to help the user better align and measure the content of the page. That is why it primary works in page Logical Units (see the Pages - Drawing Scale section for more info).

     Origin and Step

    The origin of the grid and rulers is the point from which the respective major lines originate. It is controlled by the OriginX and OriginY properties and is measured in the page Logical Units. By default it is set to 0.

    Both the grid and rulers can have X and Y step mode, which defines the way in which the respective major step is defined. The XStepMode and YStepMode properties can take values of the ENStepMode enumeration:

    • Fine - the page chooses an automatic step that is twice smaller than the Normal step.
    • Normal - the page chooses an automatic step that is appropriate for the current ZoomFactor of the page.
    • Coarse - the page chooses an automatic step that is twice larger than the Normal step.
    • Fixed - the page uses a fixed step. The fixed step amount is controlled by the FixedXStep and FixedYStep properties respectively.
     Grid Appearance

    The way in which the grid is displayed is controlled by the GridStyle property that accepts values from the ENGridStyle enumeration:

    • MajorLines - the grid is displaying only major lines.
    • MajorMinorLines - the grid is displaying major and minor lines.
    • Interlaced - the grid is displaying major lines, the stripes of which are painted in interlaced fashion both horizontally and vertically.
    • InterlacedHorizontally - the grid is displaying major lines, the stripes of which are painted in interlaced fashion only horizontally.
    • InterlacedVertically - the grid is displaying major lines, the stripes of which are painted in interlaced fashion only vertically.

    The MajorLinesStroke and MinorLinesStroke properties control the appearance of the major and minor gridlines respectively.

    The HorizontalStripesColor and VerticalStripesColor properties control the filling of the horizontal and vertical stripes respectively. 

     Rulers Appearance
    The MinorTickCount property controls the number of minor ticks between major ones. The ValuesFormatter attribute controls the formatting of the ruler values.