Delphi应用程序中的框架行为问题

发布于 2024-07-23 11:27:14 字数 190 浏览 4 评论 0原文

我有一个广泛使用框架的应用程序,需要根据当时处于活动状态的表单隐藏/显示某些按钮。 为了保持按钮整齐且组织得当,我将它们放在面板上,并根据每个表单的需要显示或隐藏面板。 我的问题是,当每个表单最初创建时,框架上的面板都是乱序的,即使我明确告诉他们要按哪个顺序排列。 隐藏并重新显示表单后,面板的顺序正确。 关于如何从一开始就让它们保持正确的顺序有什么建议吗?

I have an application that uses a frame extensively and needs to hide/show certain buttons depending on which form is active at the time. In order to keep the buttons neat and organized appropriately, I have put them on panels and show or hide the panels as needed for each form. My problem is when each form is initially created, the panels on the frame are out of order even though I am explicitly telling them which order to put themselves into. After I hide and re-show the form, the panels are in the correct order. Any suggestions on how to keep them in the proper order from the very beginning?

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

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

发布评论

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

评论(5

变身佩奇 2024-07-30 11:27:15

不要给面板明确的位置,而是尝试让它们对齐。 它们往往比普通方式粘得更好,并且如果您调整表单大小,它们可以更好地调整大小。

Instead of giving the panels explicit positions, try giving them alignments. They tend to stick better than way, and they do a better job of resizing if you resize the form.

草莓酥 2024-07-30 11:27:15

您还可以尝试使用 stackpanel(或者是 flowpanel?)作为面板的父级。 然后您将拥有可以操纵的订单而不是头寸。

You can also try using a stackpanel (or was it flowpanel?) as parent for the panels. Then you will have a order instead of a position to manipulate.

茶色山野 2024-07-30 11:27:15

也许你可以看看 DevExpress LAyoutControl? 它可以帮助我们创建始终看起来不错的界面,无论我们是否显示或隐藏某些组/面板。 如果您愿意,它甚至允许运行时自定义界面!

Maybe you can have a look at the DevExpress LAyoutControl? It helps us creating interfaces that always look good, no matter if we show or hide certain groups / panels. It even allows for run-time customization of the interface, if you want that!

a√萤火虫的光℡ 2024-07-30 11:27:15

您可以尝试通过坐标来组织它们,即:设置顶部和左侧。 除非你的面板对齐,否则这总是有效的(但需要做很多工作)。

You may try to organize them by coordinates i.e.: setting Top and Left. Unless your panels are aligned, this will always work (but it takes bit lot of work).

呆橘 2024-07-30 11:27:15

我遇到了这个问题,我发现解决方案是在 FormCreate 中(或在框架的 CMShowingChanged 方法中)执行此操作:

MyPanel1.Align := alNone;
MyPanel2.Align := alNone;
MyPanel1.Align := alBottom;
MyPanel2.Align := alBottom;

按照您需要的顺序恢复 - 这似乎可以直观地整理顺序。

I had this problem and I found that the solution was to do this in FormCreate (or in a CMShowingChanged method of your frame):

MyPanel1.Align := alNone;
MyPanel2.Align := alNone;
MyPanel1.Align := alBottom;
MyPanel2.Align := alBottom;

Restore in the order that you need - this seemed to sort out the order visually.

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