关于打印的,急

bluemarry 2006-06-07 04:37:55
我用这段代码得到打印机信息
var
ADevice, ADriver, APort: array[0..255] of Char;
DeviceHandle: THandle;
DevMode: PDeviceMode;
begin
//初始化打印机
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
if DeviceHandle = 0 then
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
end;
if DeviceHandle = 0 then
Raise Exception.Create('不能初始化打印机!')
else
DevMode := GlobalLock(DeviceHandle);

//然后,我用DevMode.dmPaperWidth和DevMode.dmPaperLength得到纸张的长度和宽度,可是发现有些打印机取到的值一直是0,不知道是怎么回事???

另外
Printer.PageWidth又是指什么长度?DevMode.dmPaperWidth不一样,我都搞混了。。。
...全文
269 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluemarry 2006-06-07
  • 打赏
  • 举报
回复
关键是为什么有些打印机得到的DevMode.dmPaperWidth和DevMode.dmPaperLength是0?
bluemarry 2006-06-07
  • 打赏
  • 举报
回复
to cncharles(旺仔)
Printer.PageWidth与Print.PageHeight是当前正在打印页的宽度与高度.

那打印机没在打印的话,取出来是0?
cncharles 2006-06-07
  • 打赏
  • 举报
回复
Printer.PageWidth与Print.PageHeight是当前正在打印页的宽度与高度.

Indicates the value of width (in pixels) of the currently printing page.

Delphi syntax:
PageWidth property (TPrinter)
property PageWidth: Integer;

C++ syntax:

__property int PageWidth = {read=GetPageWidth, nodefault};

Description

Use PageWidth to find the width in pixels of the currently printing page.

dmPaperLength
For printer devices only, overrides the length of the paper specified by the dmPaperSize member, either for custom paper sizes or for devices such as dot-matrix printers that can print on a page of arbitrary length. These values, along with all other values in this structure that specify a physical length, are in tenths of a millimeter.
dmPaperWidth
For printer devices only, overrides the width of the paper specified by the dmPaperSize member.

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧