怎么做到让程序窗口始终显示在桌面最上层 即始终掩盖在其他打开的窗口之上 求C 实现代码

怎么做到让程序窗口始终显示在桌面最上层 即始终掩盖在其他打开的窗口之上 求C 实现代码

首页维修大全综合更新时间:2024-12-05 20:14:41

怎么做到让程序窗口始终显示在桌面最上层 即始终掩盖在其他打开的窗口之上 求C 实现代码

今天我尝试了一下,在窗体打开的时候开一个线程,然后这个线程里面一直设置TopMast=true就可以解决你的问题.Thread mustTop = new Thread(() => { while (!this.IsDisposed)//如果程序没有关闭,他就一直在上面. { this.Invoke(new Action(() => { this.TopMost = true; })); Thread.Sleep(1000);//可以隔一段时间设置一次 } }); mustTop.Start();

大家还看了
也许喜欢
更多栏目

© 2021 3dmxku.com,All Rights Reserved.