help!!!!!我在程序中怎么设置QuickRep和打印机,才能让打印机打印出我自定义的纸张大小的区域!
我对打印机的设置如下:
var
aDevice: array[0..CCHDEVICENAME-1] of Char;
aDriver: array[0..MAX_PATH-1] of Char;
aPort: array[0..31] of Char;
hDevMode: THandle;
pDevMode: PDeviceMode;
begin
// 获取打印机DeviceMode的句柄
Printer.GetPrinter(aDevice, aDriver, aPort, hDevMode);
if hDevMode <> 0 then
begin
// 获取指向DeviceMode的指针
printer.PrinterIndex:=printer.PrinterIndex;
pDevMode := GlobalLock(hDevMode);
if pDevMode <> nil then
begin
pDevMode^.dmPaperSize := DMPAPER_USER; //自定义纸张
pDevMode^.dmPaperLength := 250; //纸长
pDevMode^.dmPaperWidth := 400; //纸宽
pDevMode^.dmFields := pDevMode^.dmFields or DM_PAPERSIZE;
pDevMode^.dmFields := pDevMode^.dmFields or DM_PAPERLENGTH;
pDevMode^.dmFields := pDevMode^.dmFields or DM_PAPERWIDTH;
ResetDC(Printer.Handle, pDevMode^);
GlobalUnlock(hDevMode);
end;
end;
我现在要让打印机只打印长为250;宽为400的纸张那么大小的区域。
以下是我对QuickRep的设置(对打印机设置后是否还要这样设置,我不知道):
QuickRep1.Page.Length:=250;
QuickRep1.Page.Width:=400;
请各位高手多多指点,在线等!!!!!!谢谢