3
votes

I have a Delphi TImage component wich show pictures. Sometimes the pictures are larger than the image size and requires scrolling. I dont want to use the stretch property and auto size property, I want to see the picture by scrolling it. how can I do this? I can use TScrollBox, but I don't know how to use it! best regards.

1
Just drop your image in a TScrollBox component at design time and set its position to the upper left corner. For smoothly animated scroll you can use code from this post.TLama
tanks a lot, but the TScrollBox doesn't need any other settings?Rojin
No. That's all. Your image just needs to be the child of the scroll box. With default settings it shows and scales progress bars automatically by its children positions and if your image is larger than the scroll box client rectangle, it shows progress bar(s) by which you can move the content (your image).TLama
@jpfollenius, if you mean enable AutoSize for the scroll box, then no. It would automatically resize the scroll box by its children and you'd never see scrollbars. For the image is AutoSize right option though. Rojin, it should work, even if you insert your image into the scroll box that way.TLama
@jpfollenius, I thought that, but had to react since the question talks about a scroll box all the time and you've commented "You have to set AutoSize to True" which is quite misleading in such context.TLama

1 Answers

2
votes

change Image.Align from alCustom to alNone