Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread How to scroll a large image?
Sat, Sep 2 2017 8:59 AMPermanent Link

Sergei Safar

Hi all,

I am a EWB newbie and have a doubt: I need to show a big image (it's a map) on a browser and I would like the users could view the various portions of the image.

I've tried to put a TScrollPannel with a TImage inside but the image do not scroll inside the container, no success.

Could anyone show me how to do it? Which components and its right properties should I use ?

Thanks a lot

Regards
Sergei Safar
Sat, Sep 2 2017 9:07 AMPermanent Link

Uli Becker

Sergei,

> I've tried to put a TScrollPannel with a TImage inside but the image do not scroll inside the container, no success.
> Could anyone show me how to do it? Which components and its right properties should I use ?

TScrollPanel should work fine for that.
Did you set any Layout properties for the Image? Are the scrollbars visible?
Show some code or a sample project please.

Uli
Sat, Sep 2 2017 11:28 AMPermanent Link

Sergei Safar

Hi Uli,

attached test.zip with files Project3 and unit3.

Thank you

Regards,

Sergei



Attachments: test.zip
Sat, Sep 2 2017 12:08 PMPermanent Link

Mark Brooks

Slikware

Avatar

Sergei

I’ve come across this before and there are a few steps required to make it work the way that you want it to:

- Remove the PNG from the TImage Background.Image property
- Add the PNG to the project as an external file
- Put the name of the PNG in the URL property of the TImage

This will now display the image, but only at runtime. You will not see it at design time.

Finally you need to size the TImage to be the same size as the PNG. To do this you should:

- Set its layout to TopLeft
- Trap its OnLoad event
- In the OnLoad event handler set Height = ActualHeight and Width = ActualWidth

This works because the TImage needs to load the PNG in order to get its size. Once it’s done this it puts the size into the ActualHeight and ActualWidth properties. By setting the Height and Width to be the same you have resized your TIMage accordingly.

If the final size of the TImage exceeds the TScrollBox then you’ll see the scroll bars exactly as you require.

Good luck
Mark
Mon, Sep 4 2017 9:00 AMPermanent Link

Sergei Safar

Mark,

it worked very fine! Thank you very much.

Thank you all for your time.

Regards,
Sergei Safar
Image