tags:

views:

66

answers:

5

I'm not sure what it's called in the land of WinForms, but in web development terms, I'm looking for a frame type element that can be added to a winform.

I want a panel that is anchored top,bottom,left,right but if the form the panel is resized to a smaller size than the elements in the panel, scroll bars will appear around the panel allowing the user to see the contents of the panel without expanding the form.

I hope that makes sense, and that such a thing exists.

Thanks!

+1  A: 

What about a panel? System.Windows.Forms.Panel

Dan at Demand
A: 

There are a couple of different panels in the standard windows controls that do what you want... just look in the toolbox when editing a windows form, under 'container'

What do you want it to contain? A web page, or just windows form controls?

James B
+1  A: 

You are looking for a "Panel" control. Just set the "Dock" property to get docking going..

Blankasaurus
+2  A: 

Yes, a Panel control. Set AutoScrollMinSize to the minimum size you want before scrollbars appear. Set AutoScroll to True. Set MinimumSize if necessary, it shouldn't be.

The controls inside the panel need to auto layout by themselves so they'll move as necessary when the panel gets smaller. Use their Dock or Anchor properties. If the layout gets complicated then switch to a TableLayoutPanel or FlowLayoutPanel control.

Hans Passant
+1  A: 

You add a Panel to your form and set Panel.Dock = Fill. Your Panel will auto-resize when you resize the form.

Set Panel.AutoScroll = True

Then, you add controls to your Panel. Set the controls' Dock property accordingly. Now, when you resize the form, scrollbars will appear if controls are covered up.

David