BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hidden TPanel does not resize when TImage->Picture->LoadFrom

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
John Grabner
Guest





PostPosted: Wed Jul 30, 2003 10:29 pm    Post subject: Hidden TPanel does not resize when TImage->Picture->LoadFrom Reply with quote



Hi,
I have a TPanel with a TImage on it. The TImage align is set to client.
When I load a bitmap the TImage has the correct height. When the TPanel
is made visible it does not show the whole Image. What do I need to do
to resize the panel?

John.

Back to top
John Grabner
Guest





PostPosted: Wed Jul 30, 2003 11:04 pm    Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load Reply with quote



JD wrote:

Quote:
John Grabner <grabnerj (AT) ihug (DOT) co.nz> wrote:

I have a TPanel with a TImage on it. The TImage align is set
to client. When I load a bitmap the TImage has the correct
height. When the TPanel is made visible it does not show the
whole Image. What do I need to do to resize the panel?


You're a bit confused how the Align property works. You have
set the Image to size to the panel by setting it's Align
property to alClient. If that is what you want, then to be
sure that the image shows in its' entirty when it's larger
than the panel, you can do one of 2 things:

Resize the panel using the Image height and width

or

Set the Image Stretch property to true.

~ JD


I need to load various images and have the panel show the whole Image.
The height of the panel can be adjusted but the width is fixed by the
size of the window. Is there a property that i can set that will do this
for me? If not how would I do it in code?

John.



Back to top
Rodolfo Frino
Guest





PostPosted: Wed Jul 30, 2003 11:13 pm    Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load Reply with quote



Although I don't use a panel in this example, you might like to have a look
the way the Align property is used
http://www.geocities.com/rodolfofrino/SplitterImage.html


Rodolfo

"John Grabner" <grabnerj (AT) ihug (DOT) co.nz> wrote

Quote:
Hi,
I have a TPanel with a TImage on it. The TImage align is set to client.
When I load a bitmap the TImage has the correct height. When the TPanel
is made visible it does not show the whole Image. What do I need to do
to resize the panel?

John.




Back to top
JD
Guest





PostPosted: Thu Jul 31, 2003 12:16 am    Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load Reply with quote


John Grabner <grabnerj (AT) ihug (DOT) co.nz> wrote:
Quote:
I need to load various images and have the panel show the
whole Image. The height of the panel can be adjusted but the
width is fixed by the size of the window.

If the panel width is fixed and you must display the whole
image, then the only choice you have (with you current design)
is to set the Image Stretch property to true and it's Align
property to alClient.

That will cause the Image to size exactly to the Panel and the
glyph will be scaled to fit and fill the entire Image. I
believe that this is what you want but there is one more issue
that you need to deal with. If the Image Height and Width are
disproportionate to the glyph's dimentions, the glyph will
appear distorted.

To compensate, since the Panel Width is fixed, you need to
adjust the Panel Height so that it's the same proportion in
relation to the glyph as what the Panel Width is.

Simply get the glyph's Height and Width after loading it and
use the Width to get the proportion of the Panels' Width:

double wFactor = (double) Panel1->Width / Image1->Picture->Width;
Panel1->Height = (int) Image1->Picture->Height * wFactor;

~ JD



Back to top
JD
Guest





PostPosted: Thu Jul 31, 2003 1:30 am    Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load Reply with quote


If you must display the entire glyph in it's original size,
then your choices are to change the Panel from being a fixed
width or use a scrollbox instead of the panel.

~ JD

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.