使用其中心作为锚点调整面板大小
我正在尝试使用调整大小效果并使用其中心作为锚点来调整面板大小。我一直在谷歌上搜索一些信息,我发现的唯一的是将horizontalCenter和verticalCenter设置为0,但这对我不起作用。面板不断从左上角/上角调整大小。
有人能更清楚地解释如何实现这一点吗?
提前致谢。
I'm trying to Resize a panel using a Resize Effect using its center as the anchor point. I've been googling for some information and the only thing I have found is to set the horizontalCenter and verticalCenter to 0, but this is not working for me. The panel keeps resizing from top/left corner.
Could anybody explain more clearly how to accomplish this?.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 Jonathan 所建议的,面板的父容器可能不使用 BasicLayout,而是使用一些液体布局(如 VerticalLayout)。当您使用液体布局时,您不能使用绝对位置属性,例如“x”、“y”、“horizontalCenter”、“verticalCenter”、“left”、“right”、“top”或“bottom”。它们将被简单地忽略,这当然是有道理的,因为对象必须相对于彼此放置。
不管怎样,这很完美:
As Jonathan suggests, the parent container of your Panel probably doesn't use a BasicLayout, but some liquid layout (like VerticalLayout). When you use a liquid layout you can not use absolute position attributes, like 'x', 'y', 'horizontalCenter', 'verticalCenter', 'left', 'right', 'top' or 'bottom'. They will simply be ignored, which of course makes sense because the objects have to be laid out relative to one another.
Anyway, this works perfectly: