如何防止单个 MDI 子窗体窃取其他所有 MDI 子窗体的焦点

发布于 2024-08-20 04:30:00 字数 124 浏览 14 评论 0原文

我的窗口中有几个 MDI 子窗体, MDI子窗体之一启动后将 导致焦点机制很奇怪,意味着另一个MDI子窗口 除非单击标题栏,否则不会获得焦点,单击 MDI 子窗体中的任何其他位置都不会导致窗体聚焦。

有什么想法吗?

There are several MDI child form within my window,
one of MDI child form after it's being launched will
cause the focus mechanism to be weird, meaning a another MDI child window
will not get the focus unless the title bar is clicked, clicking
anywhere else in the mdi child form will not caused the form to focus.

any thoughts?

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

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

发布评论

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

评论(1

日裸衫吸 2024-08-27 04:30:00

如果我有足够的代表,我会将其作为评论,因为这只是一个猜测,因为问题中没有太多信息。

尝试确保 MDI 子级正在处理单击事件,以确保将焦点设置到正在单击的窗体上。我还没有真正注意到这样的行为,唯一想到的是您以某种方式覆盖正在填充的其他 MDI 子项上的默认鼠标单击行为,但由于我不认为您可以覆盖标题栏单击,我认为这是这就是它仍然有效的原因。

可以稍微解释一下您在 MDI 子进程内部所做的事情,以便我们可以更好地了解可能导致此行为的情况。

I would put this as a comment if I had enough rep since it's only a guess because there isn't a lot of information in the question.

Try making sure that the MDI children are handling the click event to make sure that focus is being set to the form that is being clicked on. I haven't ever really noticed behavior like this the only think of is you are somehow overriding the default mouseclick behavior on the other MDI children that are being populated, but since I don't think you can override the title bar click I think this is why it still works.

Could explain what you're doing inside of the MDI child a little so we can get a better understanding of what is going on that could be causing this behavior.

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