全部在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;