Reputation: 10499
I have a Panel in my Form, and I have a personal UserControl. I want to add in my Panel some instances of this UserControl (one above the other - Y order). I set the Dock property of these controls to Top. Something like the following code
for(int i = 0; i < 10; i++)
{
panel1.Controls.Add(new MyUserControl
{
Dock = DockStyle.Top,
});
}
The problem is that, even if there are more controls than can be displayed, the vertical scrollbar dows not appear. Why? Also the controls are added in reverse order.
How can I solve these problems?
Upvotes: 2
Views: 1586
Reputation: 1
Had the same problem. AutoScroll
property didn't helped.
Adding VScrollBar
to Panel solved it, but in result I get 2 scroll bars.
So final recipe:
AutoScroll
property to true;VScrollBar
to Panel;VscrollBar
width to '0'(little bit dummy - but it works)Upvotes: 0