打印问题!! 找不出毛病所在了! (100分)

  • 主题发起人 主题发起人 拥有
  • 开始时间 开始时间

拥有

Unregistered / Unconfirmed
GUEST, unregistred user!
由于论坛不能发表图片,所以我把详细的问题和打印后的图片贴在了另一个地址,
下面是链接,请高手帮我看看,问题出在哪里?
http://61.174.215.61/img/bbs/dispbbs.asp?boardID=8&ID=50
 
有人知道吗? 急啊! 我搞了好久都没搞好
 
全部在Printer的canvas上画,不要用write,
在uses下添加printers
procedure TForm1.N6Click(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

//
//rewrite(prntext);
//调用REWRITE函数,为输出打开已分配的文件
printer.canvas.font:=label1.Font;
//把当前MEMO1的字体指定给打印对象的CANVAS的字体属性
// writeln(prntext,'');
printer.Canvas.TextOut('');
//writeln(prntext,'');
printer.Canvas.TextOut('');
// writeln(prntext,' '+edit1.text+' 工作台平面度检测记录');
printer.Canvas.TextOut(' '+edit1.text+' 工作台平面度检测记录');
// writeln(prntext,'');
printer.Canvas.TextOut('');
// writeln(prntext,'');
printer.Canvas.TextOut('');
// writeln(prntext,' 允许平面度公差: '+edit5.text+' MM'+' 检验员:'+edit6.text);
printer.Canvas.TextOut(' 允许平面度公差: '+edit5.text+' MM'+' 检验员:'+edit6.text);
printer.canvas.draw(100,150,image1.picture.graphic);
printer.canvas.font:=stringgrid1.Font;
// writeln(prntext,'');
printer.Canvas.TextOut('');
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);
//system.close(prntext);
//关闭打印文件
printer.EndDoc;
end;

 
这是由于打印机分辨率不同造成的。
你可以先取出打印机的分辨率。
Var
PointX,PointY:integer;
PointX:=GetDeviceCaps(printer.Handle,LOGPIXELSX);
PointY:=GetDeviceCaps(printer?Handle,LOGPIXELSY);
然后在于x,y坐标相关值分别乘上PointX,PointY .
其中x,y单位是英寸。
 
接受答案了.
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部