A
Aland
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure SetPaperSize(X, Y: Integer);
var
Device, Driver, Port: PChar;
HDMode: THandle;
PDMode: PDevMode;
begin
Device := StrAlloc(cchDeviceName);
Driver := StrAlloc(MAX_PATH);
Port := StrAlloc(32);
try
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, HDMode);
if HDMode <> 0 then
begin
PDMode := GlobalLock(HDMode);
if PDMode <> nil then
begin
with PDMode^do
begin
dmPaperSize := 256;
// ---
dmPaperWidth := X;
dmPaperLength := Y;
dmFields := dmFields or DM_PAPERSIZE or DM_PAPERWIDTH or DM_PAPERLENGTH;
GlobalUnlock(HDMode);
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
end;
finally
StrDispose(Device);
StrDispose(Driver);
StrDispose(Port);
end;
end;
procedure anewprint(theline,thepage:Integer);
var
oldy,oldx:integer;
begin
with Printerdo
begin
...
oldy:=pageheight;
oldx:=pagewidth;
SetPaperSize(pagewidth,pageheight);
...
end;
end;
我的问题是:
经过调用SetPagerSize()后,pagewidth,pageheight的值变小了。
这个SetPagerSize()过程有什么问题吗?(我想保留原值,另设纸张大小
打印,最后再恢复原值。)应该如何实现?
我用的是LQ1600K针打。
var
Device, Driver, Port: PChar;
HDMode: THandle;
PDMode: PDevMode;
begin
Device := StrAlloc(cchDeviceName);
Driver := StrAlloc(MAX_PATH);
Port := StrAlloc(32);
try
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, HDMode);
if HDMode <> 0 then
begin
PDMode := GlobalLock(HDMode);
if PDMode <> nil then
begin
with PDMode^do
begin
dmPaperSize := 256;
// ---
dmPaperWidth := X;
dmPaperLength := Y;
dmFields := dmFields or DM_PAPERSIZE or DM_PAPERWIDTH or DM_PAPERLENGTH;
GlobalUnlock(HDMode);
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
end;
finally
StrDispose(Device);
StrDispose(Driver);
StrDispose(Port);
end;
end;
procedure anewprint(theline,thepage:Integer);
var
oldy,oldx:integer;
begin
with Printerdo
begin
...
oldy:=pageheight;
oldx:=pagewidth;
SetPaperSize(pagewidth,pageheight);
...
end;
end;
我的问题是:
经过调用SetPagerSize()后,pagewidth,pageheight的值变小了。
这个SetPagerSize()过程有什么问题吗?(我想保留原值,另设纸张大小
打印,最后再恢复原值。)应该如何实现?
我用的是LQ1600K针打。