MFC:使对话框始终位于一小部分其他对话框之上
谷歌搜索得出了如何使对话框“始终位于最前面”的结果。但这不是我想要的。
假设我有大量的对话框。在这堆对话框中,考虑其中的 3 个——A、B 和 C。
我希望 C 始终位于 A 和 B 的顶部,而不是其余对话框的顶部。换句话说,如果 C 处于活动状态,那么它应该位于顶部,否则它将位于另一个活动对话框的下方,除非它涉及 A 和 B。
顺便说一句,A 和 B 永远不能同时出现。
这样,我成功做到这一点的唯一方法就是每次销毁 C,然后用新的父级(A 或 B,取决于谁可见)重新创建它。我了解到,一旦创建子对话框,所有权就无法转移,因此需要销毁。
我不能继续破坏它(说来话长)。
还有其他方法可以实现这一目标吗?谢谢!
Google-ing yields results on how to make a dialog "always on top" of everything. This is not what I want, though.
Say I have a huge amount of dialogs. Within this pile of dialogs, consider 3 of them -- A, B and C.
I want C to always be on top of A and B, but not the rest of the pile. In other words, if C is active, then it should be on top, otherwise it will be below another active dialog, except for when it involves A and B.
And by the way, A and B can never appear at the same time.
With that, the only way I've managed to do it is by destroying C every time, and then re-create it with a new parent (A or B, depending who is visible). I've learned that once child dialogs are created, the ownership cannot be transferred, hence the need to destroy.
I cannot afford to keep destroying it (long story to it).
Any other way to achieve this? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 A 或 B 中拥有 C 窗口的句柄,那么当您想要将 C 设置为 TopMost 时,向 C 发送用户定义的消息怎么样?
If you have the handle to C's window in A or B, how about sending a user-defined message to C, when ever you want to set C as TopMost ?