根据表单大小调整面板大小
问题描述:
我在WinForm上使用了面板.当我调整表格大小或最大化或最小化表格时,我希望面板相应地调整大小.
我必须修改什么属性?
截图: http://img839.imageshack.us/img839/3157/capturezhy.png [ ^ ]
Hi,
I have used a Panel on my WinForm. When I resize the form, or maximize or minimize the form, I wanted that the Panel should resize accordingly.
What property would I have to modify?
Screenshot: http://img839.imageshack.us/img839/3157/capturezhy.png[^]
答
您可以为此使用anchor属性.您首先将面板放置在窗体上,然后将锚点启用到左侧,顶部,右侧和底部.然后,面板将相对于表单调整大小.
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.control.anchor%28VS.71%29.aspx [ http://www.tutorialized.com/view/tutorial/C-Resizing-controls-with-form-Anchor-property/52689 [
You can use the anchor property for this. You first place the panel on the form and then enable the anchors to left, top, right and bottom. The panel will then resize relative to the form.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor%28VS.71%29.aspx[^]
http://www.tutorialized.com/view/tutorial/C-Resizing-controls-with-form-Anchor-property/52689[^]
Good luck!