D
delhpi
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Draw(Acanvas: TCanvas);begin with Acanvas do begin font.name := '宋体'; font.size := 11; textout(100,100, '姓名'); //这里的坐标应该如何计算,才能实现,预览和打印的一致? end;end;procedure TForm1.Button1Click(Sender: TObject);var mymetafile: Tmetafile; cv: TCanvas;begin if not CheckBox1.Checked then begin printer.BeginDoc; Draw(printer.canvas); printer.enddoc; end else begin MyMetafile := Tmetafile.Create; try cv := TMetafileCanvas.Create(MyMetafile, printer.Handle); try Draw(cv); finally cv.Free; end; image1.Canvas.StretchDraw(Image1.Canvas.ClipRect , MyMetafile);//image1上本身有个jpg图片,想在上面再画文字。 finally mymetafile.Free; end; end;end;