多谢三位了,终于搞定了,请看以下代码来自qusoft.
如果你没有quickreport的源码,你将无法解决这个问题;
Printer setup, paper formats and bins
Amended : 3rd October 2001
The printer setup dialog provideddo
es not work as expected.
The following changes to QRPrntr.pas will make the standard
printer object the output device.
SEE ALSO : Adding extra bins and paper formats
====================== CHANGES =============================
1. TQRPrinterSettings.ApplySettings - disable most of this proc,
leaving only the Orientation setting to be made.
procedure TPrinterSettings.ApplySettings;
begin
FPrinter.GetPrinter(FDevice, FDriver, FPort, DeviceMode);
DevMode := GlobalLock(DeviceMode);
{$ifdef DISABLED}
// QBS Printer 1. Put in these condionals and
// all the code between them is ignored
{$endif}
SetField(dm_orientation);
if Orientation=poPortrait then
DevMode^.dmOrientation := dmorient_portrait
else
DevMode^.dmOrientation := dmorient_landscape;
FPrinter.SetPrinter(FDevice, FDriver, FPort, DeviceMode);
GlobalUnlock(DeviceMode);
end;
2. TQRPrinter.create - amend as shown here -
..
..
FPrinterOK := Printer.Printers.Count > 0;
// QBS PRINTER 2 point aPrinter to Printer.
//aPrinter := TPrinter.Create;
aPrinter := printer;
..
..
3. TQRPrinter.Destroy - amend as shown -
destructor TQRPrinter.Destroy;
begin
if Status <> mpReady then
Cleanup;
if FCloseControl <> nil then
FCloseControl.Free;
// QBS PRINTER 3. no need to free.
//aPrinter.Free;
aPrinterSettings.Free;
PageList.Free;
if FPage <> nil then
FPage.Free;
if Client <> nil then
if Client is TQRPreview then
TQRPreview(Client).QRPrinter:= nil;
inherited Destroy;
end;
4. TQRPrinter.SetPrinterIndex - amend as shown.
procedure TQRPrinter.SetPrinterIndex(Value : integer);
begin
if PrinterOK then
begin
aPrinter.PrinterIndex := Value;
// QBS PRINTER 4. two lines out
// If you have problems losing some settings
// try restoring the lines below.
//ResetDriver(aPrinter);
//aPrinterSettings.GetPrinterSettings;
end;
end;