防止在显示其他表单时出现主表单 [英] Prevent main form from appearing when showing another form

查看:59
本文介绍了防止在显示其他表单时出现主表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将辅助表单带到前台,但是当我这样做时

I am trying to bring my secondary form to the Foreground, however when I do

MyForm.Show; // It may be hidden, therefore show it first
SetForegroundWindow(MyForm.Handle);

我的主表单也出现了。我唯一可以防止这种情况的方法是执行 MainForm.Hide; ,但是我必须避免这种情况。

my Main Form appears aswell. The only way I can prevent that is to do MainForm.Hide; but I got to avoid that.

想法是让我的辅助表单出现在另一个应用程序的顶部,而我的主表单也不必这样做。

The idea is to have my secondary form appear on top of another application, without my Main Form having to do so as well.

推荐答案

如果您考虑为此功能制作另一个应用程序,那么您可能还会考虑以下折衷方案:将MainForm最小化到任务栏上(而不是隐藏它),以防止在激活其他表单时弹出它。

If you consider to make another application for this functionality, then you may also consider the following compromise: minimize the MainForm to the taskbar (rather than hiding it) to prevent it popping up when activating another form.

如果是这样,请尝试这个答案。它确实在辅助表单的任务栏上添加了一个额外的图标,但是我想那不会有问题,因为其他应用程序也可以。但是,如果MainForm没有最小化但被其他窗口所混淆,则激活辅助表单也会弹出MainForm,就像您现在正在体验的那样。

If so, then try this answer. It does add an extra icon to your taskbar for the secondary form, but I guess that'll be no problem since a different application would either. However, if the MainForm is nót minimized but obfuscated by other windows, activating the secondary form wíll also popup the MainForm, just like you are experiencing now.

答案的缘故,但绝不是作为建议:此答案描述了一个(完全是实验性的)构造,以制作完全独立的窗口。我花了很少的时间测试该解决方案,它似乎奏效了,但要准备好不再依赖VCL的全部/默认功能。

And for the completeness of this answer's sake, but not by any means meant as advice: this answer describes a (somewhat experimental) construction to make fully independent windows. The little time I tested that solution, it seemed to work, but be prepared not counting any longer on the full/default functionality of the VCL.

这篇关于防止在显示其他表单时出现主表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆