使表单停留在所有其他应用程序之上 [英] Making a Form stay on top of ALL other applications

查看:98
本文介绍了使表单停留在所有其他应用程序之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪里都能找到答案,那就是使用API​​ SetWindowsPos.这在VB6中效果很好,我已经使用了很多年了.似乎没有任何作用,在VB.Net(VS 2008)中是否还有其他人发现了该问题,解决方案是什么?

Everywhere I look the answer is use the API SetWindowsPos. This works great in VB6 and I have been using it for years. It seems to have no effect what so ever in VB.Net (VS 2008) has anybody else found this and what is the solution?

推荐答案

怎么了?使用 Form.TopMost [ SetForegroundWindow [
What''s wrong with using the Form.TopMost[^] property?

Is there any reason why you want the form to be topmost?
To me it seems like you just want to bring the form/window in front of every other window to draw the user''s attention to it, am I right?
In that case, you would want to use the SetForegroundWindow[^] function.


大家好

感谢您的回答,我知道"TopMost",但是它并没有按我预期的那样工作.我的项目是通过文件的到达创建一个窗口/窗体.该标签在任务栏中闪烁,以引起用户对其的注意.如果他什么都不做,则在一定时间后将表格设为TopMost.它不起作用.仅当在不使用计时器的情况下创建表单时设置了TopMost时,它才似乎起作用.我已完成工作,方法是关闭原始表单,然后使用TopMost集打开一个新表单.

但是没有回答我有关API SetWindowsPos的原始问题.为什么它在VB6中而不在VB.Net中起作用.我以为只要传递参数就可以了,API是独立于编程语言的,无论它应该如何工作.
Hi Guys

Thanks for the answers I was aware of "TopMost" but it didn''t work quite as I expected. My project is that a window/form is created by the arrival of a file. The tag is flashed in the task bar to draw the users attention to it. If he does nothing then after a certain time then the form is made TopMost. It doesn''t work. It only seems to work if the TopMost is set when the form is created not after a dely using a timer. I have done a work around by closing the original form and opening a new one with the TopMost set.

But doesn''t answer my original question about the API SetWindowsPos. Why does it work in VB6 and not VB.Net. I thought an API was programming language independent as long as the parameters were passed OK it should work regardless.


您尝试了

this.Topmost = true;


它使该表单显示在所有其他表单的最上方.
Did you try

this.Topmost = true;


It makes the form appear topmost of all other forms.


这篇关于使表单停留在所有其他应用程序之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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