Simple I hope, let me know if the following is not want you wanted...
You know each grid columns width. You base that on 100% and expand or contract as
needed.
Say Grid (ClientWidth not width, we don't want scroll bars to take any room) is 400
Pixels
Grid has 3 columns
Col1 is 100 Pixels
Col2 is 200 Pixels
and
Col3 is 100 Pixels
Then you know that Col1, and Col3 are 25% of the width of the grid, and Col2 is 50%
You now find out how many pixels the QR report is.
Then when you create the controls for QR you just base that on the width of the
report. So say the report is 3000 pixels wide then Col1 is (3000 = 100%) div
(100%/25%) = 750 Pixels
A =3000 = Quick Report Band Width in Pixels
B =400 = Grid Client Width
C =100 = Grid Column Width for Col1 and Col3
C1=200 = Grid Column Width for Col2
Col1 = A / (B / C) = 750
Col2 = A / (B / C1) = 1500
Col3 = A / (B / C) = 750
SO to get the # of pixels that the band is consuming use the following formula.
Var
SavedUnits : TQRUnit;
fwidth : Integer;
begin
SavedUnits := QuickRep1.Units;
QuickRep1.Units := Pixels;
try
{ Return the band width in pixels }
fwidth := Trunc(QRBAND1.Size.Width);
finally
QuickRep1.Units := SavedUnits;
end;
end;
You have to do some other things when you want to adjust for preview mode, but since
you already have a grid on the screen, you probally do not want a preview, just a
print option.
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Steven Wild
> Sent: Wednesday, 12 May 1999 07:02
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Print grid
>
>
> Already done that but I have an additional 'want" that i haven't
> mentioned .... i want it to make an intelligent adjustment of font
> size to fit across a sheet of paper - either portrait or landscape!
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz