Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Scrolling With A TScrollBox 1

Status
Not open for further replies.

Elkari

Programmer
May 1, 2001
144
US
I put a scroll box on a form and set the Align property to Client. I then added a TImage box in that, also setting its Align property to Client. The AutoScroll property of the TScrollBox states it will display the scroll bars as needed if set to TRUE, which it is. When I load large BMPs, no scroll bars appear.

I even tried setting AutoScroll property to FALSE and use the HorzScrollBar.Visible and VertScrollBar.Visible properties to turn each scroll bar on or off if then image coming in is larger in height or width to the TScrollBox. This does not work either.

Is there a problem with the TScrollBox or am I not pairing them together correctly?
 
The problem is that you have set your TImage's Align to alClient. Setting an object's Align to alClient forces it to perfectly fill its parent object -- no bigger, no smaller. As such, scrollbars never appear.

Change the TImage's Align to alNone. Move and/or resize it within the TScrollBox, and you should see the TScrollBox's scrollbars appear and disappear, right here within the form designer, without needing to compile or run.

Now set the TImage's AutoSize to True. Now when you load a larger or smaller image, the TImage will resize as needed, and the TScrollBox's scrollbars should appear and disappear as needed. -- Doug Burbidge mailto:doug@ultrazone.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top