请教谁能在NT下自定义纸张(100分)

  • 主题发起人 主题发起人 NotesDev
  • 开始时间 开始时间
N

NotesDev

Unregistered / Unconfirmed
GUEST, unregistred user!
我的一个很幼稚的系统,是关于医疗保险报销的
需要自己定义纸张,为节省机器,在药品库存管理部门
使用的NT兼服务器。
请教如何自定义纸张
 
控制面板--打印机--属性---纸张?
或者找个构件用用,呵呵
 
打印机属性里就可以设的
 
procedure TForm1.Button1Click(Sender: TObject);
var
Device:Array[0..256] of Char;
Driver:Array[0..256] of Char;
Port:Array[0..32] of Char;
hDMode:THandle;
pDMode:PDevMode;
begin

Printer.GetPrinter(Device,Driver,Port,hDMode);
if hDMode<>0 then

pDMode:=GLobalLock(hDMode);
if pDMode<>nil then

begin

pDMode^.dmPaperSize:=256;
pDMode^.dmPaperLength:=1140;
pDMode^.dmPaperWidth:=1900;
pDMode^.dmFields:=pDMode^.dmFields or DM_PAPERSIZE;
pDMode^.dmFields:=pDMode^.dmFields or DM_PAPERLENGTH;
pDMode^.dmFields:=pDMode^.dmFields or DM_PAPERWIDTH;
end;

ResetDC(Printer.Handle,pDMode^);
GLobalUnLock(hDMode);
end;


procedure TForm1.Button2Click(Sender: TObject);
begin

With Printerdo

begin

begin
Doc;
Canvas.TextOut(10,10,'fkgfjhg');
EndDoc;
end;

end;

 
又落后了

// 纸张改为 A4
uses WinSpool;
procedure TFrom1.PreparePrinter;
var
hPrinter: THandle;
PrtInfo: PPrinterInfo1;
DevMode: PDeviceMode;
pcbNeeded, PDevModeBytes: DWORD;
begin

OpenPrinter('Epson LQ-1600K', hPrinter, nil);
GetMem(PrtInfo, 1024);
GetPrinter(hPrinter, 1, PrtInfo, 1024, @pcbNeeded);
PDevModeBytes :=do
cumentProperties(Handle, hPrinter, PrtInfo^.pDescription, DevMode^, DevMode^, 0);
GetMem(DevMode, pDevModeBytes);
do
cumentPropertied(Handle, hPrinter, PrtInfo^.PDescription, DevMode^, DevMode^, DM_OOT_BUFFER);
DevMode^.dmPaperSize := DMPAPER_A4;
DevMode^.dmFields := DevMode^.dmFields or DM_PAPERSIZE;
do
cumentProperties(Handle, hPrinter, PrtInfo^.PDescription, DevMode^, DevMode^, DM_IN_BUFFER);
FreeMem(PrtInfo);
FreeMem(DevMode);
end;
 
多人接受答案了。
 
后退
顶部