| View previous topic :: View next topic |
| Author |
Message |
John Grabner Guest
|
Posted: Wed Jul 30, 2003 10:29 pm Post subject: Hidden TPanel does not resize when TImage->Picture->LoadFrom |
|
|
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
|
Posted: Wed Jul 30, 2003 11:04 pm Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load |
|
|
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
|
Posted: Wed Jul 30, 2003 11:13 pm Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load |
|
|
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
|
Posted: Thu Jul 31, 2003 12:16 am Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load |
|
|
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
|
Posted: Thu Jul 31, 2003 1:30 am Post subject: Re: Hidden TPanel does not resize when TImage->Picture->Load |
|
|
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 |
|
 |
|