public
{ Public-Deklarationen }
FMF:TMetafile;
end;
var
Form1: TForm1;
implementation
Const
C_WishedWidth=2900;
C_WishedHeight=2100;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:Integer;
Mfc: TMetaFileCanvas;
x,y:Integer;
begin
Mfc := TMetaFileCanvas.Create(FMF, 0);
for I := 0
to 100
do
begin
Mfc.Font.Color :=
RGB(random(255),Random(255),Random(255));
Mfc.Pen.Color :=
RGB(random(255),Random(255),Random(255));
Mfc.Brush.Style := bsClear;
Mfc.Textout(random(2800),Random(2000),Format('
Test %d',[i]));
Mfc.Brush.Style := bsSolid;
Mfc.Brush.Color :=
RGB(random(255),Random(255),Random(255));
x := Random(2800);
y := Random(2000);
Mfc.Ellipse( x,y,
x+ Random(200),
y+Random(200)
);
end;
Mfc.Free;
image1.Picture.Assign(FMF);
if Checkbox1.Checked
then
begin
Printer.Orientation := poLandScape;
Printer.Begindoc;
Printer.Canvas.StretchDraw(Rect(0,0,Printer.PageWidth,printer.PageHeight),FMF);
Printer.EndDoc;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FMF:=TMetafile.Create;
FMF.Width := C_WishedWidth;
FMF.Height := C_WishedHeight;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FMF.Free;
end;