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.
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 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!
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.