86

How do you add a scrollbar to a Panel control with many controls in windows form application?

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
Chetan
  • 1,517
  • 3
  • 17
  • 25

1 Answers1

131

Just set the AutoScroll property of your Panel to true and it will handle adding the scrollbars for you.

this.panel1.AutoScroll = true;
Samuel
  • 37,778
  • 11
  • 85
  • 87
  • 51
    Bear in mind that your controls will need to be anchored to the Top of the Panel to cause Vertical scroll bars automatically, and the Left of the Panel to cause Horizontal scroll bars automatically. If Anchor is set to None that control will be ignored by AutoScroll. I tried to add this to the answer but it was rejected. – Jason S Nov 17 '11 at 21:04
  • 14
    In addition, your controls shouldn't be docked in the panel or the scrollbar won't appear either. – namey Oct 16 '16 at 20:48