当前打印机的纸张大小(A3还是A4等等)

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
Device: Array[0..(cchDeviceName -1)] of char;
Driver: Array[0..(MAX_PATH -1)] of char;
Port: Array[0..32] of char;
HDMode : THandle;
PDMode: PDevMode;
begin
Printer.PrinterIndex := Printer.PrinterIndex
Printer.GetPrinter(Device,Driver,Port,HDMode);
if HDMode <> 0 then
begin
PDMode := GlobalLock(HDMode);
if PDMode <> nil then
begin
case pDMode.dmPaperSize of
DMPAPER_USER: showmessage('纸张类型:自定义');
DMPAPER_A3: showmessage('纸张类型:A3');
DMPAPER_A4: showmessage('纸张类型:A4');
DMPAPER_A5: showmessage('纸张类型:A5');
DMPAPER_B4: showmessage('纸张类型:B4');
DMPAPER_B5: showmessage('纸张类型:B5');
else showmessage('纸张类型:其它');
end;
GlobalUnLock(HDMode);
Printer.PrinterIndex := Printer.PrinterIndex;
end;
end;
end;
 
 

Similar threads

I
回复
0
查看
651
import
I
S
回复
0
查看
688
SUNSTONE的Delphi笔记
S
S
回复
0
查看
683
SUNSTONE的Delphi笔记
S
I
回复
0
查看
844
import
I
后退
顶部