L
lzb
Unregistered / Unconfirmed
GUEST, unregistred user!
用Qreport做一套打表格,表格的式样在Qreport中已定义好了,
QuickRep1.Page 为 custom;
QuickRep1.Page.length=200;
//mm
QuickRep1.Page.width=150;
打印时如下:
SetPaperSize(1500,2000);//0.1mm
Form1.QuickRep1.Prepare;
Form1.QuickRep1.Printer.Print;
在打印前自定义纸张,程序如下:
Form1.SetPaperSize(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中搞的,
这这么办???
QuickRep1.Page 为 custom;
QuickRep1.Page.length=200;
//mm
QuickRep1.Page.width=150;
打印时如下:
SetPaperSize(1500,2000);//0.1mm
Form1.QuickRep1.Prepare;
Form1.QuickRep1.Printer.Print;
在打印前自定义纸张,程序如下:
Form1.SetPaperSize(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中搞的,
这这么办???