Quick Report
From: max@newlook.co.nz (Max Nilson)
artemik@ix.netcom.com (Bill Artemik) wrote: I'm using Delphi 2.0 and QuickReports 1.1 >I created a VERY complex (graphically, anyway) report and just found >out that ALTHOUGH it previews fine in design mode, does NOT display or >print correctly in runtime. The error appears to be that I'm running >with LARGE fonts in Windows 95! What a crock!I too was getting this problem _very_ seriously, but only when printing from Win 95 to the office HP 4M, or when viewing the report under NT 4.0. The _exact_ same application when run under NT 3.51 SP5 worked perfectly.
I had seen discussion of one other bug in the NT 4.0 GDI code, so I wasn't suprised when the above test showed that there seemed to be another. I looked very closely at the QuickReports code and noticed that the primary text output routine alters its ouput font for every field. Its does this via the following code segment in TQRCustomControl.Print:
QRPrinter.Canvas.Font:=Font; QRPrinter.Canvas.Font.size:=trunc(abs(parentreport.xpos(font.size))); QRPrinter.Canvas.brush.Color:=Color;
The upshot of all this is that _every_ field of the report was being drawn using a newly alocated font resource, and probably driving the meta file recorder into spasms trying to keep track of all this choping and changing of font resources.
A quick hack where by I created a non printing label of the same size as the scaled printer font, thereby keeping the resource cached, made the bug go away! This proved that there is some sort of problem with the NT 4.0 ehnanced meta file recorder and too many font changes.
A better hack has been introduced into QuickReports as follows:
// MRN Save the printer font while setting new font SaveFont := TFont.Create; SaveFont.Assign(QRPrinter.Canvas.Font); QRPrinter.Canvas.Font:=Font; QRPrinter.Canvas.Font.size:=trunc(abs(parentreport.xpos(font.size))); QRPrinter.Canvas.brush.Color:=Color; // MRN Free the saved printer font. Its done its work now. SaveFont.Free; SaveFont := nil;
So if you have a registered version of QuickReports thaen you simply make this patch and things will run faster, smother and no more font corruptions will occur due to the limitations of the enhanced meta file code and the GDI.
You can set QRPrinter PreviewCaption to your caption like this:
QRPrinter.PreviewCaption := 'My Caption';
From: cannibal@bigfoot.com
Hi! Have you looked at the TPrinter-object?Printer.PrinterIndex:=0; Sets the first printer you have installed Printer.PrinterIndex:=-1; Sets the printer to the default printer