如何使用 DevExpress LayoutControl 的 minWidth、minHeight?
我已经开始使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您无法在 LayoutControl 中指定控件的最小高度/宽度。您当然可以使用标准
constraints
属性,它可以工作,但看起来很难看。但问题是你到底想实现什么目标? LayoutControl 尝试调整其控件大小,以便一切都尽可能合适。由于许多控件都挤在太小的空间中,因此会出现滚动条,但还会发生什么?
设置良好的可调整大小布局的关键是调整布局项/组的 AlignHoriz 和 AlignVert 属性。对于可调整大小的控件(例如备忘录或网格),将它们设置为 ahClient/avClient 。另外,您通常希望 LayoutControls 的
AutoContentSizes
为[acsWidth,acsHeight]
说到版本,我建议您升级到最新版本并尝试 LayoutControl V2,与 v1 相比,它具有一些附加功能,例如对拆分器和选项卡的支持。
这是一个可以逻辑调整大小的简单表单的示例,您可以将其粘贴到空表单中:
希望有帮助
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
andAlignVert
properties of layout items/groups. Set these toahClient/avClient
for controls that are resizable, like say a Memo or a Grid. Also you generally want the the LayoutControls'sAutoContentSizes
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:
Hope it helps