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

TppDBImage + AutoSize

edited September 2009 in General
Hi,


RbPro 11.06, Delphi 2006


A little annoyance with the TppDBImage at design-time:

If you have a TppDBImage with an empty image and set AutoSize to true then
it is resized to zero width and height. You can resize it but its
immediately resized tot 0,0 when you try to click on it the open the
pop-menu.
TppImage behaves a little better. It is resized to 0,0 when AutoSize is set
to true, but if you then make it larger its stays that size. I think the
reason for the difference is that when you resize a TppDBImage it calls
LoadImage and then PictureChanged where the size is reset to zero.
For now i have added a test in TppCustomImage.PictureChanged to not the
resize when designing:

<---------------------------------------------------------------------------------------
procedure TppCustomImage.PictureChanged(Sender: TObject);
begin

if (csReading in ComponentState) or (csLoading in ComponentState) then
Exit;

if AutoSize and (FPicture.Width > 0) and (FPicture.Height > 0) then
spSetBounds(spLeft, spTop, FPicture.Width, FPicture.Height);

if AutoSize and (FPicture.Graphic = nil) then
if not (pppcDesigning in DesignState) and not(Printing) then //
<=== Added
spSetBounds(spLeft, spTop, 0, 0);

InvalidateDesignControl;

if (GeneratingNewPage) then
Inc(FImageID);

end; {procedure, PictureChanged}
-------------------------------------------------------------------------------------->


So both TppImage and TppDBImage are never resized to zero with an empty
image.



Regards,

Max Paay
Quadrant Software bv.
The Netherlands.




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4409 (20090909) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Comments

  • edited September 2009

    When the report is generating the image must always be re-sized. So we can
    modify it to this

    if not(pppcDesigning in DesignState) or (Printing) then
    spSetBounds(spLeft, spTop, 0, 0);



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.