IF hDMode=0 Then//如果句柄为0,表示打印机没有装载。
Begin
Printer.PrinterIndex:=Printer.PrinterIndex;
Printer.GetPrinter(pDevice,PDriver,pPort,hDMode);
End;
IF hDMode=0 Then //如果句柄仍为0,表示有错误发生。
Raise Exception.Create('系统运行错误:无法获取打印机参数!')
Else //如果不为0,则开始调用。
Begin
PDMode:=GlobalLock(HDMode);
IF PDMode<>Nil Then
With PDMode^ Do
Begin
DMFields:=DMFields OR DM_PAPERSIZE;
dmPaperSize:=256;
DMFields:=DMFields OR DM_PaperLength;
dmPaperLength:=1030; // 设置纸张长度。
dmFields:=dmFields OR DM_PaperWidth;
dmPaperWidth:=1400; // 设置纸张宽度。
End;
GlobalUnLock(hDMode);
Printer.PrinterIndex:=Printer.PrinterIndex;
End;
没有做其他设置,但运行起来虽然能定义纸张大小,但是不能定位里面的打印内容,并且当设置
printer.Canvas.TextOut(50,50,nian);//交寄日期时间年
printer.Canvas.TextOut(100,50,yue);//交寄日期时间月
printer.Canvas.TextOut(150,50,ri);//交寄日期时间日
打印位置参数时打印机还报错,怎么回事啊我对delphi很不熟悉请大家给点建议吧
怎样做到准确定位啊
哭求大家了!!!!!!!!!!!!!!!!!!!!
Begin
Printer.PrinterIndex:=Printer.PrinterIndex;
Printer.GetPrinter(pDevice,PDriver,pPort,hDMode);
End;
IF hDMode=0 Then //如果句柄仍为0,表示有错误发生。
Raise Exception.Create('系统运行错误:无法获取打印机参数!')
Else //如果不为0,则开始调用。
Begin
PDMode:=GlobalLock(HDMode);
IF PDMode<>Nil Then
With PDMode^ Do
Begin
DMFields:=DMFields OR DM_PAPERSIZE;
dmPaperSize:=256;
DMFields:=DMFields OR DM_PaperLength;
dmPaperLength:=1030; // 设置纸张长度。
dmFields:=dmFields OR DM_PaperWidth;
dmPaperWidth:=1400; // 设置纸张宽度。
End;
GlobalUnLock(hDMode);
Printer.PrinterIndex:=Printer.PrinterIndex;
End;
没有做其他设置,但运行起来虽然能定义纸张大小,但是不能定位里面的打印内容,并且当设置
printer.Canvas.TextOut(50,50,nian);//交寄日期时间年
printer.Canvas.TextOut(100,50,yue);//交寄日期时间月
printer.Canvas.TextOut(150,50,ri);//交寄日期时间日
打印位置参数时打印机还报错,怎么回事啊我对delphi很不熟悉请大家给点建议吧
怎样做到准确定位啊
哭求大家了!!!!!!!!!!!!!!!!!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货