关闭。这个问题需要更多 focused .它目前不接受答案。
想改进这个问题?更新问题,使其仅关注一个问题 editing this post .
7年前关闭。
Improve this question
如果我的 winforms 应用程序的用户调整主窗体的大小,我希望 2 个面板以及子控件也可以拉伸(stretch)。
我怎样才能做到这一点?
最佳答案
If the user of my winforms application resizes the main form, I want the 2 panels to stretch out also, along with the child controls.
您是 TableLayoutPanel 的理想用例(MSDN)。如果您只是缩放面板,则 Dock 和 Anchor 将是合适的。但是由于您希望控件能够很好地扩展,因此您几乎处于 AutoLayout 世界中,并且可能是 TableLayoutPanel。 (顺便说一下,我是这个的 super 粉丝,尽管过度使用会对布局控件产生负面的性能影响。)
有关使用它来配置布局以进行缩放的一些有用链接:
关于winforms - 在 winforms 应用程序中调整主窗体大小时如何调整面板大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/174355/