//a lot cheaper to print your rulers instead of buying them
procedure Tform1.PrintCmRuler;
var j,k,margin,m : integer;
begin PrinterSetupDialog1.Execute; //for best result set it to 300 DPI
printer.BeginDoc;
margin:=0; //margin in inches if desired
//Each logical unit is mapped to 0.1 millimeter.
//Positive x is to the right; positive y is up.
SetMapMode(printer.Canvas.Handle, MM_HIMETRIC); // unit is 1/100 milimeter
with printer.Canvas do
begin font.Size:=60; k:=-26500;
for j:=0 downto k do //10*image1.Height-1 do
begin m:=26-(-j div 1000);
if j mod 1000 =0 then
begin moveto(margin,j); lineto(margin+750,j); //moveto(0,j);
textout(margin+760,j,inttostr(m))
end
else
if (m>0)and(j mod 500 =0) then
begin
moveto(margin,j); lineto(margin+300,j);
end else
if (m>0)and(j mod 100 =0) then
begin
moveto(margin,j); lineto(150+margin,j);
end;
end;
moveto(margin,0); lineto(margin,k)
end;
printer.EndDoc
end;
No comments:
Post a Comment