X
xll
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个套打程序,版面是在Qreport中设计的,在Qreport中定义如下:
Qreport的纸张类型为custom,长100mm,宽60mm,
打印时:From1.Qreprot.QRprinter.free;
From1.Qreprot.QRprinter:=nil;
From1.Qreprot.print;
为了自定义纸张类型,在Qreport的beforprint事件中加了下列程序:
setpagesize(60,100);
以下为 setpagesize 的过程
procedusr setpagesize(x,y:integer)
var
Device: array[0..255] of char;
Driver: array[0..255] of char;
Port: array[0..255] 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
if (x = 0) or (y = 0) then
begin
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
pDMode^.dmPaperSize := DMPAPER_FANFOLD_US;
end
else
begin
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE or
DM_PAPERWIDTH or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperWidth := x
pDMode^.dmPaperLength := y
end;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
打印时打印机只是动了一下便无任何反应,????
Qreport的纸张类型为custom,长100mm,宽60mm,
打印时:From1.Qreprot.QRprinter.free;
From1.Qreprot.QRprinter:=nil;
From1.Qreprot.print;
为了自定义纸张类型,在Qreport的beforprint事件中加了下列程序:
setpagesize(60,100);
以下为 setpagesize 的过程
procedusr setpagesize(x,y:integer)
var
Device: array[0..255] of char;
Driver: array[0..255] of char;
Port: array[0..255] 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
if (x = 0) or (y = 0) then
begin
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
pDMode^.dmPaperSize := DMPAPER_FANFOLD_US;
end
else
begin
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE or
DM_PAPERWIDTH or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperWidth := x
pDMode^.dmPaperLength := y
end;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
打印时打印机只是动了一下便无任何反应,????