Ok, hier mal die die vollständige Routine:
Delphi-Quellcode:
procedure TDWFotoBook.PaintGrid(Show: Boolean = True);
procedure DrawDots;
var
i : Integer;
j : Integer;
begin
with FImageEnVect do
begin
// draw dots
for i := 0 to Width div FGridWidth do
begin
for j := 0 to Height div FGridWidth do
begin
Bitmap.Canvas.Pixels[i * FGridWidth, j * FGridWidth] := clBlack;
end;
end;
Update;
end;
end;
begin
Assert(Assigned(ImageEnVect), IENIL);
// deselect all layers, otherwise we would draw on the selected layer
FImageEnVect.LayersCurrent := 0;
// set pen mode
if (Show and not FShowGrid) or (Show and FShowGrid) then
begin
FImageEnVect.Bitmap.Canvas.Pen.Mode := pmBlack;
end
else if (FShowGrid and not Show) or (not FShowGrid and not Show) then
begin
FImageEnVect.Bitmap.Canvas.Pen.Mode := pmNotXor;
end;
DrawDots;
Self.FShowGrid := Show;
end;