TStatusBar 与底部对齐面板
我有一个带有 TStatusBar
和底部对齐的 TPanel
、底部对齐的 TSplitter
和客户端对齐的 TPanel
的表单,如下面的截图所示:
(分离器被涂成红色,使其更显眼一些)显而易见)
Button1 只是增加了Panel1 的高度增加 20:
Panel1.Height := Panel1.Height + 20;
但是当单击时,控件的顺序会发生变化,Panel1 会超出状态栏,并且拆分器现在会调整状态栏的大小。
仅当 Panel1 的高度增加超过 StatusBar1 的高度 (19 )。
我认为这是由两个底部对齐的控件引起的,但我不知道问题的确切原因以及如何解决它。
我目前使用的是XE2,但D2010也有同样的问题。
在这种情况下,有没有办法将 Panel1 的高度设置为任意值,同时确保控件保持其预期位置?
I have a form with a TStatusBar
, and bottom aligned TPanel
, a bottom aligned TSplitter
and client aligned TPanel
, as shown in the following screenshot:
(The splitter is coloured red to make it a little more obvious)
Button1 simply increases the height of Panel1 by 20:
Panel1.Height := Panel1.Height + 20;
But when clicked the order of the controls changes, with Panel1 being blow the status bar and the splitter is now resizing the status bar.
This only happens when the height of Panel1 is increased by more than the height of StatusBar1 (19).
I assume this is caused by having two bottom aligned controls, but I'm at a loss as to the exact cause of the problem and how to work around it.
I'm currently using XE2, but I have the same issue with D2010.
In this situation is there a way to set the height of Panel1 to an arbitrary value, while ensuring that the controls maintain their expected positions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过在更改面板高度后设置控件的 Top 属性来解决此问题。
Work around the problem by setting the Top property for the controls after changing the panel height.
试试这个(对我来说效果很好):
Try this (worked fine for me):
或者,如果您不想跟踪更改控件位置/大小的位置,
Alternatively, if you don't want to keep track of where you're changing position/size of controls,