开发者

A Frame Inside Of A Winform?

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 p开发者_开发技巧anel, 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!


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.


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


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


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜