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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control Autoscroll

Status
Not open for further replies.

l310564

Programmer
Jun 18, 2006
50
0
0
GB
Hi,

I have a user control that is built dynamically at run time. The problem is that no matter how many controls i add the AutoScroll bar doesn't appear. I have spent hours trying to get this to work and would appreciate any help.

Cheers,

Hugh


 
Should work as long as AutoScroll is set to True and you have one or more controls placed outside of the visible boundaries of the usercontrol.

There is another issue to consider - docked controls are not accounted for in determining whether the scroll bars appear as they will be re-positioned to dock to the visible area.
 
Ha! I was complaining that I couldn't help people and I actually found two where I might. Now likely I'll stick my foot in my mouth, but this is what I can tell you so far.

1) AutoScroll Must be set to true.
2) AutoScrollMinSize has to be set to at least (1, 1)
3) You can Dock Controls, but you may have focus issues. (i.e. depending on the control(s) it may not receive the focus correctly)

This was the only way I could get it to work for me and some of the problems I've had. So if it is wrong blame it on Microsoft.

-I hate Microsoft!
-Forever and always forward.
 
Thanks you two,

I still couldn't get it to work but i found something on google that was of interest.

My control only uses labels, to my surprise i read that the autoscroll function doesn't work with dynamically built labels! (way to go MS). So i created a text box beside each label with a size of (0,0) and all works perfectly. I would be interested to know if this is a bug or if i was doing something incredibly stupid!

Cheers,

Hugh
 
Don't hold me to this 100%, but I think it likely because a label doesn't gain user focus. This is lame, but the AutoScroll isn't just a normal scroll bar it is meant to "auto" scroll to the control, outside of the visible portion of the form, that has focus. If the control can't get focus then the AutoScroll doesn't feel the need to show up. It see it as nothing to scroll (focus) to. The AutoScroll has caused me no end of troubles in my current project.

-I hate Microsoft!
-Forever and always forward.
 
Cheers Sorwen,

Prehaps we could ask microsoft to change it? lol
 
Hehe. I wish. My list is slightly long though. If I was a more angry person I would also tempted to take an unabridged dictionary and beat several people there with it. I would start with the definition of "Standard" and then maybe "Logical" and then just kind of continue on from there.

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top