F
feifan
Unregistered / Unconfirmed
GUEST, unregistred user!
哈哈。。。这是我写的一代对于此题目的代码。。。哈哈,不能用,请指正!
(不要笑我笨,从书上抄都不会用。。哈哈。。就是这么菜。。我也没办法呀!哈哈。!)
procedure TvlPrint.ChagePageSize(vlHeight, vlWidth: Integer);
//vlHeight是以0.1mm为单位的;
var
ADevice, ADriver, APort : Array[0..255] of Char;
DeviceHandle : THandle;
DevMode : PDeviceMode;
begin
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
if DeviceHandle = 0 then
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
end;
if DeviceHandle = 0 then
Raise Exception.Create('Cound Not Initialize TDeviceMode Structure')
else
DevMode := GlobalLock(DeviceHandle);
With DevMode^do
begin
dmFields := dmFields or DM_PAPERLENGTH;
dmPaperWidth := vlHeight;
end;
With DevMode^do
begin
dmFields := dmFields or DM_PAPERWIDTH;
dmPaperWidth := vlWidth;
end;
//?? Printer.SetPrinter(ADevice, ADriver, APort, DeviceHandle);
if not (DeviceHandle = 0) then
GlobalUnLock(DeviceHandle);
end;
(不要笑我笨,从书上抄都不会用。。哈哈。。就是这么菜。。我也没办法呀!哈哈。!)
procedure TvlPrint.ChagePageSize(vlHeight, vlWidth: Integer);
//vlHeight是以0.1mm为单位的;
var
ADevice, ADriver, APort : Array[0..255] of Char;
DeviceHandle : THandle;
DevMode : PDeviceMode;
begin
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
if DeviceHandle = 0 then
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(ADevice, ADriver, APort, DeviceHandle);
end;
if DeviceHandle = 0 then
Raise Exception.Create('Cound Not Initialize TDeviceMode Structure')
else
DevMode := GlobalLock(DeviceHandle);
With DevMode^do
begin
dmFields := dmFields or DM_PAPERLENGTH;
dmPaperWidth := vlHeight;
end;
With DevMode^do
begin
dmFields := dmFields or DM_PAPERWIDTH;
dmPaperWidth := vlWidth;
end;
//?? Printer.SetPrinter(ADevice, ADriver, APort, DeviceHandle);
if not (DeviceHandle = 0) then
GlobalUnLock(DeviceHandle);
end;