The grid can be displayed in several styles. The grid style is controlled by the GridStyle property, which can accept one of the following values:
-
MajorLines - draws a grid of major lines
-
MajorDots - draws a grid of major dots
-
MajorMinorLines - draws a grid of major-minor lines
-
Interlaced - horizontal and vertical stripes are displayed on each odd row and col
-
InterlacedHorizontally - horizontal stripes are displayed on each odd row
-
InterlacedVertically - vertical stripes are displayed on each odd col
Depending on the grid style, different self-explanatory properties of the grid are used to control the appearance of the rendered strokes and filled areas. The following example makes an interlaced grid with semi - transparent yellow horizontal stripes, blue vertical stripes and red major lines:
C# |
Copy Code
|
---|---|
// show the grid grid.Visible = true; // change its style grid.GridStyle = GridStyle.Interlaced; // change its appearance grid.HorizontalStripesFillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Yellow)); grid.VerticalStripesFillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue)); grid.MajorLinesStrokeStyle = new NStrokeStyle(1, Color.Red); |
Visual Basic |
Copy Code
|
---|---|
' show the grid grid.Visible = True ' change its style grid.GridStyle = GridStyle.Interlaced ' change its appearance grid.HorizontalStripesFillStyle = New NColorFillStyle(Color.FromArgb(50, Color.Yellow)) grid.VerticalStripesFillStyle = New NColorFillStyle(Color.FromArgb(50, Color.Blue)) grid.MajorLinesStrokeStyle = New NStrokeStyle(1, Color.Red) |
By default the grid is only displayed within the document bounds - i.e. the grid is clipped with the document bounds. You can instruct it to occupy the entire viewport, by setting the ClipWithDocumentBounds property to false:
C# |
Copy Code
|
---|---|
// display the grid in the entire viewport grid.ClipWithDocumentBounds = false; |
Visual Basic |
Copy Code
|
---|---|
' display the grid in the entire viewport grid.ClipWithDocumentBounds = False |