如何使一个窗口始终保持领先地位。净? [英] How to make a window always stay on top in .Net?

查看:258
本文介绍了如何使一个窗口始终保持领先地位。净?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#WinForms应用程序运行在其他程序中的宏。其他程序会不断弹出窗口,通常使事情看起来,由于缺乏一个更好的词,疯狂的。我想实现一个取消按钮,将停止该进程的运行,但我似乎无法得到留在上面的窗口。我如何在C#中做到这一点?

I have a C# winforms app that runs a macro in another program. The other program will continually pop up windows and generally make things look, for lack of a better word, crazy. I want to implement a cancel button that will stop the process from running, but I cannot seem to get the window to stay on top. How do I do this in C#?

编辑:我曾尝试最顶层=真; ,但其他程序不断弹出自己的窗口在上面。是否有办法把我的窗口顶端每隔n毫秒?

I have tried TopMost=true; , but the other program keeps popping up its own windows over top. Is there a way to send my window to the top every n milliseconds?

编辑:我解决这个问题的方法是通过增加系统托盘图标,将通过双击取消该过程就可以了。该系统托盘图标并没有得到掩盖。谢谢所有谁回答。我读了为什么没有一个'超级对顶'窗口的文章...它在逻辑上是行不通的。

The way I solved this was by adding a system tray icon that will cancel the process by double-clicking on it. The system tray icon does no get covered up. Thank you to all who responded. I read the article on why there is not a 'super-on-top' window... it logically does not work.

推荐答案

Form.TopMost 将工作,除非其他程序正在创建最顶层的窗口。

Form.TopMost will work unless the other program is creating topmost windows.

有没有方法来创建不在另一个进程新的最顶层窗口的窗口。雷蒙德陈解释原因。

There is no way to create a window that is not covered by new topmost windows of another process. Raymond Chen explained why.

这篇关于如何使一个窗口始终保持领先地位。净?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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