drawGrid

drawGrid(style:  Integer;
         width:  Real;
         height: Real;
         color:  Integer);

The drawGrid method of the Window class draws a grid on the window, using the Window class constants listed in the following table.

Window Class Constant Value Description
DrawGrid_Crosses 1 Small crosses drawn at the grid line intersection
DrawGrid_Dots 2 Dots drawn at the grid line intersections
DrawGrid_Lines 0 Horizontal and vertical grid lines

The drawGrid method parameters are listed in the following table.

Parameter Description
style DrawGrid_Lines (0), DrawGrid_Crosses (1), or DrawGrid_Dots (2)
width Increment in units specified by the scaleMode property between each vertical grid line
height Increment in units specified by the scaleMode property between each horizontal grid line
color Color of the pen used to draw the grid

Grid lines for the left and top edges of the window are not drawn. The grid lines are drawn by using the Window::drawWidth, Window::drawStyle, and Window::drawMode properties. For the line style (that is, DrawGrid_Lines) when drawWidth= 1, drawWindow= 0 (client area), and scaleMode = 0 (that is, ScaleMode_Pixels), the result is the same as if you were to write the code in the following method.

vars
    x : Integer;
    y : Integer;
begin
    foreach x in width to clientWidth - 1 step width do
        window.drawLine(x, 0, x, clientHeight, color);
    endforeach;
    foreach y in height to clientHeight - 1 step height do
        window.drawLine(0, y, clientWidth, y, color);
    endforeach;
end;