Keep form on desktop at all times (No Win+D effect

2019-06-21 13:03发布

问题:

I'm working on a project in which I need a form to stay on the desktop at all times. This would mean that it should still be showing even if a user clicks Win+D to hide/show desktop.

If anyone uses Rainmeter, they will know how meters stay on the desktop despite clicking on the show desktop key.

I really don't mind how to do it, as long as it works. I've looked through hundreds of examples but half of them don't work..

Maybe someone could help me out.

Thanks in advance.

回答1:

I fired up C# and created a Windows Forms application. I set the forms' TopMost property to True, and its MinimizeBox property to False.

When I run the app, the Window is always on top, even if I use Win+D or click Show Desktop.

I got the idea from here: What is the difference between Minimize All and Show Desktop?



回答2:

If you want something to stay on the desktop, you should put it on the desktop. Look at using Windows Gadgets which can do what you want.



标签: c# forms winapi