procedure TForm1.DrawBackground;
var FScale : integer;
FGridX :double;
FGridY :double;
procedure Line(x, y, x1, y1: Integer);
begin
Canvas.MoveTo(x, y);
Canvas.LineTo(x1, y1);
end;
function ReverseColor(AColor: TColor): TColor;
var
iR0, iR1, iG0, iG1, iB0, iB1: integer;
begin
iR0 := GetRValue(AColor);
iR1 := 255 - iR0;
iG0 := GetGValue(AColor);
iG1 := 255 - iG0;
iB0 := GetBValue(AColor);
iB1 := 255 - iB0;
Result := RGB(iR1, iG1, iB1);
end;
procedure DrawPoints;
var
GridBmp: TBitmap;
i: Extended;
c: TColor;
dx, dy: Extended;
begin
c := ReverseColor(self.Color);
FScale := 1;
FGridX := 5; // 96 / 25.4
FGridY := 5; // 96 / 25.4
dx := FGridX * FScale;
dy := FGridY * FScale;
if (dx > 2) and (dy > 2) then
begin
GridBmp := TBitmap.Create;
GridBmp.Width:= Width;
GridBmp.Height := 1;
GridBmp.Canvas.Pen.Color := self.Color;
GridBmp.Canvas.MoveTo(0, 0);
GridBmp.Canvas.LineTo(Width, 0);
i := 0;
while i < Width do
begin
GridBmp.Canvas.Pixels[Round(i), 0] := c;
i := i + dx;
end;
i := 0;
while i < Height do
begin
Canvas.Draw(0, Round(i), GridBmp);
i := i + dy;
end;
GridBmp.Free;
end;
end;
begin
DrawPoints;
end;