winforms - 在 winforms 应用程序中调整主窗体大小时如何调整面板大小?

标签 winforms resize

关闭。这个问题需要更多 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 粉丝,尽管过度使用会对布局控件产生负面的性能影响。)

有关使用它来配置布局以进行缩放的一些有用链接:
  • AutoLayout By Examples
  • WinForms AutoLayout Basics: TableLayoutPanel
  • Video Training on TableLayoutPanel
  • 关于winforms - 在 winforms 应用程序中调整主窗体大小时如何调整面板大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/174355/

    相关文章:

    c# - 为什么 WinForm Form.FormClosed 事件不从窗体持有者触发?

    c# - 需要定义控制流和功能

    c# - 在 C# 中调整多行文本框的大小

    c# - 如何在 C# 中记录输入 (keyListener)

    javascript - 使用 jQuery 调整窗口大小的背景

    php - 使用 GD 调整图像大小问题

    qt - QGraphicsItem 交互式调整大小

    c# - WinForm设计器错误打开设计器

    javascript - 如果内容未填满窗口,动态调整 div 高度以将页脚保持在底部

    javascript - 在 toDataURL 之前缩放图像 - html2canvas