如何检查窗口确实是可见的Windows窗体? [英] How to check if window is really visible in Windows Forms?

查看:230
本文介绍了如何检查窗口确实是可见的Windows窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常你用Form.Visible检查窗口是可见的。但有时在屏幕窗口低于其他窗口,以便它真的看不见的。

Normally you use Form.Visible to check if Window is visible at all. But sometimes on the screen window is below other windows so it's really invisible.

那么如何检查在C#Windows窗体,如果窗口是真的可见或不?

So how to check in c# Windows Forms if window is really visible or not?

我想做到这一点:当我点击我的键盘上的Ctrl + K和我的窗口可见我的屏幕上它什么都不做。但是,当它是它会弹出顶端其他窗口的下方(移到前面)。

I would like to accomplish this: when I click CTRL+K on my keyboard and my window is visible on my screen it does nothing. But when it's underneath other windows it pops to the top (Bring to front).

亲切的问候

推荐答案

您可以调用的 启用 的形式方法,将其带到前方,如果它是不是已经。

You can call the Activate method on the form to bring it to the front if it isn't already.

不过,请注意,如果不同的程序被激活时,它通常会简单地闪烁桌面按钮(取决于你来自哪里调用它)。这是Windows的标准的保护,防止重点窃取并你不应该去解决它

However, note that if a different program is active, it will usually simply flash the desktop button (depending where you call it from). This is Windows' standard protection against focus-stealing and you should not try to work around it.

这篇关于如何检查窗口确实是可见的Windows窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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