Aber leider die ScrollBox hat kein Canvas
sonst hätte ich folgendes gemacht:
Delphi-Quellcode:
procedure TForm1.FormPaint(Sender: TObject);
var
i, j, k, n: Integer;
ACanvas: TCanvas;
R: TRect;
begin
ACanvas := Form1.Canvas;
R := Form1.ClientRect;
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.width := 2;
ACanvas.Pen.Color := clRed;
//ACanvas.Brush.Color := clLtGray;
ACanvas.Brush.Color := clBlue;
for i := 0 to (R.Right - R.Left) div 32 do
for j := 0 to (R.Bottom - R.Top) div 32 do
begin
n := Round(32 * i);
k := R.Top + Round(32 * j);
ACanvas.MoveTo(n, k);
ACanvas.LineTo(n+1, k+1);
end;
end;