Draw Grid

<< Click to Display Table of Contents >>

Navigation:  Programming > Printing and PDF Export > Watermarks >

Draw Grid

Draw a 0.5 cm grid using light blue color, this grid is also printed

 

var i,j : Integer;

begin

   toCanvas.Pen.Width := 0;

   toCanvas.Pen.Color := $00FAD5AF;

   toCanvas.Pen.Style := psSolid;

  for i:=1 to 1000 do

  begin

     j := PageRect.Left + MulDiv(WPCentimeterToTwips(0.5 * i), Xres, 1440);

    if j>= PageRect.Right then break;

     toCanvas.MoveTo(j, PageRect.Top);

     toCanvas.LineTo(j, PageRect.Bottom);

  end;

 

  for i:=1 to 1000 do

  begin

     j := PageRect.Top + MulDiv(WPCentimeterToTwips(0.5 * i), Yres, 1440);

    if j>= PageRect.Bottom then break;

     toCanvas.MoveTo(PageRect.Left, j);

     toCanvas.LineTo(PageRect.Right, j);

  end;

end;