Nick
Nick

Reputation: 10499

Panel and ScrollBar - compact Framework

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

Answers (2)

kpakozz96pyc
kpakozz96pyc

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:

  • set AutoScroll property to true;
  • add VScrollBar to Panel;
  • set VscrollBar width to '0'(little bit dummy - but it works)

Upvotes: 0

gliderkite
gliderkite

Reputation: 8928

Set the AutoScroll property of your panel to TRUE.

Upvotes: 2

Related Questions