从级联中排除某些 MDI 子窗口
我编写了一个包含许多子表单的 MDI 应用程序,每个子表单都不同。假设用户创建了三个子窗体:第一个窗体的左上角位于屏幕坐标 0,0 处;第一个窗体的左上角位于屏幕坐标 0,0 处;第一个窗体的左上角位于屏幕坐标 0,0 处;第二个表单已被拖动到屏幕的右侧(坐标 100, 300),第三个表单出现在坐标 20,20 处。如果我使用主窗体的级联命令,那么第二个窗体将移动到10,10。
我希望第二个表格保持在原来的位置,并使第三个表格移动到 10, 10 (即级联顺序的第二位)。有没有办法从主窗体的“级联”命令中排除特定的 MDI 子窗体?
I have written an MDI app with many child forms, each different. Let's say that the user has created three child forms: the first form has its top left hand corner at screen coordinates 0,0; a second form has been dragged to the right hand side of the screen (coordinates 100, 300) and the third form appears at coordinates 20,20. If I use the main form's cascade command, then the second form will move to 10,10.
I would like the second form to stay where it is and get the third form to move to 10, 10 (ie second place of cascading order). Is there any way of excluding specific MDI child forms from the main form's 'Cascade' command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法影响通过发送
WM_MDICASCADE
消息发送到 MDI 容器窗口,ClientHandle
。现在,看看
WM_MDICASCADE
,它有一个选项可以跳过级联中禁用的 MDI 子项。因此,您可以禁用某些子窗口,自己发送WM_MDICASCADE
消息,然后重新启用子窗口。我没有尝试这样做,但在我看来它很可能会起作用。您的另一个选择是实现您自己的 MDI 子定位方法。这实际上是比较容易做到的。我建议您查阅 Wine 项目的源代码以了解如何执行此操作。关键文件是
user32
DLL 中的mdi.c
。There is no way to influence the behaviour of the
Cascade
method which is implemented by sending aWM_MDICASCADE
message to the MDI container window,ClientHandle
.Now, looking at
WM_MDICASCADE
it has an option to skip disabled MDI children from cascading. So you could disable certain child windows, send aWM_MDICASCADE
message yourself and then re-enable the child windows. I've not attempted to do this but it seems very likely to me that it would work.Your other option is to implement your own MDI child positioning method. This is actually relatively easy to do. I would suggest that you consult the source code for the Wine project to get an idea how to do this. The key file is
mdi.c
in theuser32
DLL.