用printer把用程序容易控制。给你一小段例子。 with printer do begin if printer.printers.text<>'' then begin printer.printerindex:=printer.printerindex;//打印机复位 getprinter(device,driver,port,ph);//取得当前打印机号 if ph<>0 then begin //置打印纸类型 pdv:=globallock(ph); if pdv<>nil then begin pdv^.dmpapersize:=dmpaper_user; pdv^.dmpaperlength:=940; pdv^.dmpaperwidth:=2100; pdv^.dmfields:=pdv^.dmfields or dm_papersize; pdv^.dmfields:=pdv^.dmfields or dm_paperlength; pdv^.dmfields:=pdv^.dmfields or dm_paperwidth; globalunlock(ph); printer.printerindex:=printer.printerindex; end; begindoc; ///////////////////开始打印//////////////////// plx:=getdevicecaps(printer.canvas.handle,logpixelsx)/72; ply:=getdevicecaps(printer.canvas.handle,logpixelsy)/72; canvas.font.PixelsPerInch:=getdevicecaps(printer.canvas.handle,logpixelsy); canvas.font.size:=11; canvas.font.name:='宋体'; canvas.textout(round(plx*(295-(length(mxdname)*2.5))),round(ply*15),mxdname); canvas.font.size:=9; canvas.textout(round(plx*30),round(ply*30),'流水号:'+inttostr(curr_lsh)); canvas.textout(round(plx*100),round(ply*30),'位置:'+main.ls.fieldbyname('位置').asstring); canvas.textout(round(plx*470),round(ply*30),'打印时间: '+formatdatetime('yyyy-mm-dd',now)); canvas.textout(round(plx*30),round(ply*45),'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
各位朋友呀,老弟在线等待呀。。 急。。行不行呀。。 magc888(繁星) 你贴的怎么在( with printer do)就出现错误呀。 我不明白。可不可以请各位大虾指教,或是有更好的方法。。
数据库操作建议找本书看看,很简单的!
网上说不清楚
with printer do
begin
if printer.printers.text<>'' then
begin
printer.printerindex:=printer.printerindex;//打印机复位
getprinter(device,driver,port,ph);//取得当前打印机号
if ph<>0 then
begin
//置打印纸类型
pdv:=globallock(ph);
if pdv<>nil then
begin
pdv^.dmpapersize:=dmpaper_user;
pdv^.dmpaperlength:=940;
pdv^.dmpaperwidth:=2100;
pdv^.dmfields:=pdv^.dmfields or dm_papersize;
pdv^.dmfields:=pdv^.dmfields or dm_paperlength;
pdv^.dmfields:=pdv^.dmfields or dm_paperwidth;
globalunlock(ph);
printer.printerindex:=printer.printerindex;
end;
begindoc;
///////////////////开始打印////////////////////
plx:=getdevicecaps(printer.canvas.handle,logpixelsx)/72;
ply:=getdevicecaps(printer.canvas.handle,logpixelsy)/72;
canvas.font.PixelsPerInch:=getdevicecaps(printer.canvas.handle,logpixelsy);
canvas.font.size:=11;
canvas.font.name:='宋体'; canvas.textout(round(plx*(295-(length(mxdname)*2.5))),round(ply*15),mxdname);
canvas.font.size:=9;
canvas.textout(round(plx*30),round(ply*30),'流水号:'+inttostr(curr_lsh));
canvas.textout(round(plx*100),round(ply*30),'位置:'+main.ls.fieldbyname('位置').asstring);
canvas.textout(round(plx*470),round(ply*30),'打印时间: '+formatdatetime('yyyy-mm-dd',now));
canvas.textout(round(plx*30),round(ply*45),'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
急。。行不行呀。。
magc888(繁星) 你贴的怎么在( with printer do)就出现错误呀。
我不明白。可不可以请各位大虾指教,或是有更好的方法。。
在线等待
就能让一个人领会了中国MIS的博大精深之处[呵呵夸张了点]。
可能吗?----------------------------------------@_@根本解决问题的方法,看书,上网查资料。谢谢