Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Centering An Image ... and more ...

edited April 2002 in General
Hi,
I'm probably suffering brain fatigue but ... I've got a report with a header
band, detail band and a footer band ... on the detail band is a ppImage that
should be centered both vertically and horizontally. The bitmap that's
loaded into the ppImage is done at run time and is of varying sizes. OK how
do you center this image vertically ? Essentially all I need to get is the
maximum height of the detail band ... but I can't ;o(. Both the Header and
Footer bands are static sizes ...

The other thing is that the images are derived from JPegs and I set the
ppImage to transparent ... it used to work with previous versions of RB but
I find that 6.01 causes the preview display color range to look as though
it's been severely reduced ... doesn't look pretty anymore ... but it prints
OK !

Many thanks.

Andrew Jameson
e-mail mailto:andrew@softspotsoftware.com
web site http://www.softspotsoftware.com

Comments

  • edited April 2002
    You can center the image vertically within the band in the detail band's
    before print method. For example:

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    ...
    { load image }
    ...
    ppImage1.Top := (ppDetailBand1.Height - ppImage1.Height) / 2;
    end;

    Please upgrade to RB 6.03 and see if that solves your image quality problem.
    Contact info@digital-metaphors.com with your registration information. If
    the problem persists, please send a minimal example project with a few
    images that show the quality problem.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited April 2002
    Hi Alexander,

    I tried this as suggested and found that the detailband height seems to get
    stuck at what it was designed with ...


    So I ended up with ...

    var
    PageWidth : integer
    begin
    with Report.PrinterSetup.PageDef do begin
    PageHeight := ppToScreenPixels(mmPrintableHeight, utMMthousandths,
    pprtHorizontal, nil);
    end; {with}
    ...
    { load image }
    ...
    ppImage.Top := (PageHeight - ppHeaderBand.Height - ppFooterBand.Height -
    ppImage.Height) / 2;

    ... seems a little messy but it works ...

    Thanks,

    Andrew
This discussion has been closed.