拥
拥有
Unregistered / Unconfirmed
GUEST, unregistred user!
1,采用PrinterSetupDialog 打印设置控件设置打印机
2,用PrintDialog 控件 打印输出
打印到虚拟打印机(即打印成图片或者pdf文档)没有问题。
如图:
可是真正到打印机上打印成纸张的时候成了这样:
[red]所有数字重叠集中在了左上角!!
不知道问题处在何处? 猜想是分辨率问题。请问如何能解决?[/red]
-----------
如下代码:
procedure TForm1.N9Click(Sender: TObject);
var
lines,xx1,yy1,uu1,ww1:integer;
prntext:system.text;
//将PRNTEXT声名为一个在SYSTEM程序单元当中定义的文本文件
begin
uu1:=160;
ww1:=410;
printer.begin
Doc;
//if printdialog1.execute then
//begin
//assignprn(prntext);
//将PRNTEST分配给打印机
//rewrite(prntext);
//调用REWRITE函数,为输出打开已分配的文件
printer.canvas.font:=label1.Font;
//把当前MEMO1的字体指定给打印对象的CANVAS的字体属性
printer.Canvas.TextOut(200,20,edit1.text);
printer.Canvas.TextOut(355,20,'工作台平面度检测记录');
printer.canvas.font:=label3.Font;
printer.Canvas.TextOut(110,70,'生产单位');
printer.Canvas.TextOut(180,70,edit2.text);
printer.Canvas.TextOut(305,70,'送检日期');
printer.Canvas.TextOut(360,70,edit3.text);
printer.Canvas.TextOut(480,70,'标识编号');
printer.Canvas.TextOut(545,70,edit4.text);
printer.Canvas.TextOut(130,113,'允许平面度公差');
printer.Canvas.TextOut(222,113,edit5.text);
printer.Canvas.TextOut(260,113,'MM');
printer.Canvas.TextOut(350,113,'检验员:');
printer.Canvas.TextOut(400,113,edit6.text);
printer.canvas.draw(100,150,image1.picture.graphic);
printer.canvas.font:=stringgrid1.Font;
printer.Canvas.TextOut(70,380,'位置/方向');
printer.Canvas.TextOut(150,380,'C --> A1');
printer.Canvas.TextOut(220,380,'B --> B1');
printer.Canvas.TextOut(290,380,'A --> C1');
printer.Canvas.TextOut(360,380,'C --> A');
printer.Canvas.TextOut(430,380,'D --> D1');
printer.Canvas.TextOut(500,380,'A1--> C1');
printer.Canvas.TextOut(570,380,'C --> C1');
printer.Canvas.TextOut(640,380,'A --> A1');
printer.Canvas.TextOut(65,410,' 0 - 200');
printer.Canvas.TextOut(65,440,' 200- 400');
printer.Canvas.TextOut(65,470,' 400- 600');
printer.Canvas.TextOut(65,500,' 600- 800');
printer.Canvas.TextOut(65,530,'800- 1000');
printer.Canvas.TextOut(65,560,'1000-1200');
printer.Canvas.TextOut(65,590,'1200-1400');
printer.Canvas.TextOut(65,620,'1400-1600');
printer.Canvas.TextOut(65,650,'1600-1800');
printer.Canvas.TextOut(65,680,'1800-2000');
printer.Canvas.TextOut(65,710,'单条最小值');
printer.Canvas.TextOut(65,740,'单条最大值');
for yy1:=1 to 12do
begin
for xx1:=1 to 8 do
begin
printer.Canvas.TextOut(uu1,ww1,stringgrid1.Cells[xx1,yy1]);
uu1:=uu1+70;
end;
ww1:=ww1+30;
uu1:=160;
end;
printer.Canvas.TextOut(65,770,'-------------------------------------------------------------------------------------------');
printer.canvas.font:=label9.Font;
printer.Canvas.TextOut(230,800,' 计算所得的平面度为: '+label9.caption);
end;
2,用PrintDialog 控件 打印输出
打印到虚拟打印机(即打印成图片或者pdf文档)没有问题。
如图:
可是真正到打印机上打印成纸张的时候成了这样:
[red]所有数字重叠集中在了左上角!!
不知道问题处在何处? 猜想是分辨率问题。请问如何能解决?[/red]
-----------
如下代码:
procedure TForm1.N9Click(Sender: TObject);
var
lines,xx1,yy1,uu1,ww1:integer;
prntext:system.text;
//将PRNTEXT声名为一个在SYSTEM程序单元当中定义的文本文件
begin
uu1:=160;
ww1:=410;
printer.begin
Doc;
//if printdialog1.execute then
//begin
//assignprn(prntext);
//将PRNTEST分配给打印机
//rewrite(prntext);
//调用REWRITE函数,为输出打开已分配的文件
printer.canvas.font:=label1.Font;
//把当前MEMO1的字体指定给打印对象的CANVAS的字体属性
printer.Canvas.TextOut(200,20,edit1.text);
printer.Canvas.TextOut(355,20,'工作台平面度检测记录');
printer.canvas.font:=label3.Font;
printer.Canvas.TextOut(110,70,'生产单位');
printer.Canvas.TextOut(180,70,edit2.text);
printer.Canvas.TextOut(305,70,'送检日期');
printer.Canvas.TextOut(360,70,edit3.text);
printer.Canvas.TextOut(480,70,'标识编号');
printer.Canvas.TextOut(545,70,edit4.text);
printer.Canvas.TextOut(130,113,'允许平面度公差');
printer.Canvas.TextOut(222,113,edit5.text);
printer.Canvas.TextOut(260,113,'MM');
printer.Canvas.TextOut(350,113,'检验员:');
printer.Canvas.TextOut(400,113,edit6.text);
printer.canvas.draw(100,150,image1.picture.graphic);
printer.canvas.font:=stringgrid1.Font;
printer.Canvas.TextOut(70,380,'位置/方向');
printer.Canvas.TextOut(150,380,'C --> A1');
printer.Canvas.TextOut(220,380,'B --> B1');
printer.Canvas.TextOut(290,380,'A --> C1');
printer.Canvas.TextOut(360,380,'C --> A');
printer.Canvas.TextOut(430,380,'D --> D1');
printer.Canvas.TextOut(500,380,'A1--> C1');
printer.Canvas.TextOut(570,380,'C --> C1');
printer.Canvas.TextOut(640,380,'A --> A1');
printer.Canvas.TextOut(65,410,' 0 - 200');
printer.Canvas.TextOut(65,440,' 200- 400');
printer.Canvas.TextOut(65,470,' 400- 600');
printer.Canvas.TextOut(65,500,' 600- 800');
printer.Canvas.TextOut(65,530,'800- 1000');
printer.Canvas.TextOut(65,560,'1000-1200');
printer.Canvas.TextOut(65,590,'1200-1400');
printer.Canvas.TextOut(65,620,'1400-1600');
printer.Canvas.TextOut(65,650,'1600-1800');
printer.Canvas.TextOut(65,680,'1800-2000');
printer.Canvas.TextOut(65,710,'单条最小值');
printer.Canvas.TextOut(65,740,'单条最大值');
for yy1:=1 to 12do
begin
for xx1:=1 to 8 do
begin
printer.Canvas.TextOut(uu1,ww1,stringgrid1.Cells[xx1,yy1]);
uu1:=uu1+70;
end;
ww1:=ww1+30;
uu1:=160;
end;
printer.Canvas.TextOut(65,770,'-------------------------------------------------------------------------------------------');
printer.canvas.font:=label9.Font;
printer.Canvas.TextOut(230,800,' 计算所得的平面度为: '+label9.caption);
end;