X,Y只是一个坐标值。
在不同分辩的打印机上,需要进行缩放,请参照以下代码:
Printer.begin
Doc;
//获得打印机分辩
px:=ROUND(GETDEVICECAPS(PRINTER.CANVAS.HANDLE,LOGPIXELSX)/72);
pY:=ROUND(GETDEVICECAPS(PRINTER.CANVAS.HANDLE,LOGPIXELSY)/72);
//打印标题
PRINTER.Canvas.Font.Name:='楷体';
PRINTER.Canvas.Font.Size:=16;
I := 3;
Printer.Canvas.TextOut(PX*70*3,PY*40, 'xxxxxxxx管理系统');
PRINTER.Canvas.Font.Name:='黑体';
PRINTER.Canvas.Font.Size:=22;
Printer.Canvas.TextOut(PX*70*4,PY*70, '考场考生安排表');
PRINTER.Canvas.Font.Size:=12;
while not MDATA.DataModule1.tkcxx.EOFdo
begin
//判断是否到尾
IF PRINTER.Canvas.PenPos.Y>=PY*72*11 then
begin
PRINTER.Canvas.TextOut(PX*72*5,ROUND(PY*72*12.5),'第'+INTTOSTR(PRINTER.PageNumber)+'页');
PRINTER.Canvas.TextOut(PX*72*8,ROUND(PY*72*12.5),DATETOSTR(NOW));