【问题标题】:How to make Windows Forms UserControl auto-resizing to docked content?如何使 Windows 窗体 UserControl 自动调整为停靠的内容?
【发布时间】:2016-04-27 01:03:37
【问题描述】:

我有一个 UserControl,我将把它放入 DevExpress PopupControlContainer

我希望 UserControl 自动调整大小以至少适合其内容,这是一个 PanelControl 包含两个按钮,停靠在底部,一个 ListBoxControl 停靠以填充其余部分。

UserControl 和面板的AutoSize 属性为True,虽然它没有停靠,但它的行为也正确,不会缩小到其内容之外。 UserControl 在未停靠时也不会缩小到面板之外。

但我希望面板停靠在底部,同时仍限制 UserControls 的最小宽度,以便其内容完全可见。

我怎样才能做到这一点?

【问题讨论】:

    标签: c# user-controls devexpress windows-forms-designer autosize


    【解决方案1】:

    在创建UserControl 对象时影响Dock 属性,如下所示:

    UserControl myUserControl= new UserControl () { Dock = DockStyle.Fill };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-22
      • 2017-02-27
      • 1970-01-01
      相关资源
      最近更新 更多