I am so glad that you are also intersted in metafile
here is the preview function code
I have no time to write the note , sorry about that.
Hope it helps .
pnltball : Tpanel;
gbprint : TgroupBox;
sgqcprint: TstringGrid;
procedure TFrmQcReportPart.TBtnPrevi
var
MFC:Tmetafilecanvas;
w,h:integer;
begin
try
if gbprint.Height < trunc(gbprint.Width * (printer.PageHeight/printe
gbprint.Height := trunc(gbprint.Width * (printer.PageHeight/printe
except
showmessage('');
exit;
end;
if TBtnPreview.Caption='previ
begin
sgqcprint.Height :=sgqcprint.DefaultRowHeig
gbtail.Top := sgqcprint.Top + sgqcprint.Height ;
w:=gbprint.Width;
h:=gbprint.Height ;
imgpreview.SetBounds(0,0,w
imgpreview.Picture.Metafil
imgpreview.Picture.Metafil
pnlpreview.SetBounds(gbpri
MFC:= TMetaFileCanvas.Create(img
try
gbprint.PaintTo(MFC.Handle
finally
MFC.Free;
end;
pnlpreview.Visible:=true;
gbprint.Visible:=false;
TBtnPreview.Caption:='Canc
end
else
begin
sgqcprint.Height:=sgqcprin
gbtail.Top := sgqcprint.Top + sgqcprint.Height ;
gbprint.Height:= gbtail.Top + gbtail.Height;
gbprint.Visible:=true;
pnlpreview.Visible:=false;
TBtnPreview.Caption:='Prev
end;
end;
Main Topics
Browse All Topics





by: msa2003Posted on 2003-04-05 at 08:58:25ID: 8275499
Use TPrinter object to paint on the printer device context canvas instead.
Use TCanvas.StretchDraw method to scale metafile. Thist means that you might specify metafile as a TCanvas.StretchDraw parameter.
Use Delphi online help for more details.
Best regards
Serge