如何使用 DevExpress LayoutControl 的 minWidth、minHeight?

发布于 2024-09-15 12:39:59 字数 253 浏览 7 评论 0原文

我已经开始使用 DevExpress LayoutControl 了。感觉很强大,但我没有得到我想要的。我想设置组件的最小宽度和最小高度,因为对话框不可能很小,但它看起来仍然不错。同时我想让用户拥有任意大的尺寸,并让组件平等地共享宽度和高度。而且我不想要任何滚动条。我怎样才能做到这一点?

还有一件事。由于其他情况,我仍然使用旧版本的Devexpress 6.38。最新版本的 LayoutControl 是否修复了许多错误?难道就是这个阻止了我吗?

/罗兰

I have started to use DevExpress LayoutControl a bit. It feels powerful but I don't get it as I want. I want to set a minwidth and minheight of components as you can't have a dialog real small and it still look good. At the same time I want to let the user have arbitrary big size and let the components have equal share of the width and height. And I don't want any scrollbars. How can I accomplish that ?

And one thing. I still use the old version 6.38 of Devexpress due to other circumstances. IS there many bugs fixed in the recent versions of the LayoutControl? Could it be this that stop me ?

/Roland

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合约呢 2024-09-22 12:39:59

我认为您无法在 LayoutControl 中指定控件的最小高度/宽度。您当然可以使用标准 constraints 属性,它可以工作,但看起来很难看。

但问题是你到底想实现什么目标? LayoutControl 尝试调整其控件大小,以便一切都尽可能合适。由于许多控件都挤在太小的空间中,因此会出现滚动条,但还会发生什么?

设置良好的可调整大小布局的关键是调整布局项/组的 AlignHoriz 和 AlignVert 属性。对于可调整大小的控件(例如备忘录或网格),将它们设置为 ahClient/avClient 。另外,您通常希望 LayoutControls 的 AutoContentSizes[acsWidth,acsHeight]

说到版本,我建议您升级到最新版本并尝试 LayoutControl V2,与 v1 相比,它具有一些附加功能,例如对拆分器和选项卡的支持。

这是一个可以逻辑调整大小的简单表单的示例,您可以将其粘贴到空表单中:

object dxLayoutControl1: TdxLayoutControl
  Align = alClient
  AutoContentSizes = [acsWidth, acsHeight]
  object Edit1: TEdit
    BorderStyle = bsNone
  end
  object Button1: TButton
  end
  object Memo1: TMemo
    BorderStyle = bsNone
  end
  object dxLayoutControl1Group_Root: TdxLayoutGroup
    ShowCaption = False
    Hidden = True
    ShowBorder = False
    object dxLayoutControl1Group1: TdxLayoutGroup
      AutoAligns = [aaHorizontal]
      AlignVert = avClient
      object dxLayoutControl1Group2: TdxLayoutGroup
        ShowCaption = False
        Hidden = True
        LayoutDirection = ldHorizontal
        ShowBorder = False
        object dxLayoutControl1Item1: TdxLayoutItem
          AutoAligns = [aaVertical]
          AlignHorz = ahClient
          Control = Edit1
        end
        object dxLayoutControl1Item2: TdxLayoutItem
          ShowCaption = False
          Control = Button1
          ControlOptions.ShowBorder = False
        end
      end
      object dxLayoutControl1Item3: TdxLayoutItem
        AutoAligns = [aaHorizontal]
        AlignVert = avClient
        Control = Memo1
      end
    end
  end
end

希望有帮助

I don't think you can specify minimal height/width of controls in LayoutControl. You could of course use the standard constraints property, it will work, but will look ugly.

The question though is what exactly are you trying to achieve ? LayoutControl attempts to adjust it's controls sizes so that everything fits as well as possible. With many controls packed in too little space the scrollbars appear, but what else can happen ?

The key to setting up a nice resizable layout is to adjust the AlignHoriz and AlignVert properties of layout items/groups. Set these to ahClient/avClient for controls that are resizable, like say a Memo or a Grid. Also you generally want the the LayoutControls's AutoContentSizes to be [acsWidth,acsHeight]

And speaking of versions, I would recommend you upgrade to latest build and try the LayoutControl V2, which has some additional features compared to v1 such as support for splitters and tabs.

Here's an example of a simple form that resizes logically, you can paste it to an empty form:

object dxLayoutControl1: TdxLayoutControl
  Align = alClient
  AutoContentSizes = [acsWidth, acsHeight]
  object Edit1: TEdit
    BorderStyle = bsNone
  end
  object Button1: TButton
  end
  object Memo1: TMemo
    BorderStyle = bsNone
  end
  object dxLayoutControl1Group_Root: TdxLayoutGroup
    ShowCaption = False
    Hidden = True
    ShowBorder = False
    object dxLayoutControl1Group1: TdxLayoutGroup
      AutoAligns = [aaHorizontal]
      AlignVert = avClient
      object dxLayoutControl1Group2: TdxLayoutGroup
        ShowCaption = False
        Hidden = True
        LayoutDirection = ldHorizontal
        ShowBorder = False
        object dxLayoutControl1Item1: TdxLayoutItem
          AutoAligns = [aaVertical]
          AlignHorz = ahClient
          Control = Edit1
        end
        object dxLayoutControl1Item2: TdxLayoutItem
          ShowCaption = False
          Control = Button1
          ControlOptions.ShowBorder = False
        end
      end
      object dxLayoutControl1Item3: TdxLayoutItem
        AutoAligns = [aaHorizontal]
        AlignVert = avClient
        Control = Memo1
      end
    end
  end
end

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文