Is the form the most?

How can I display something all over another application. I want to show something in the whole form of my program, and all other programs open on my desktop (not mine).

* Back to top Most do not work, I tested, and my browser can go to my application: S

Here is the image when I use TopMost for TRUE. You can see my browser above it ...

http://www.freeimagehosting.net/uploads/5a98165605.png

+6
c #
source share
4 answers

You can use an instance of the form and set the TopMost property to True.

<h / "> If you want to be above all Windows, there is another way to call Win32 Api .

Here is what you could do:

In your form class add:

[System.Runtime.InteropServices.DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd); 

In the download form you can add:

 SetForegroundWindow(this.Handle); 

That should do the trick.

Update

TopMost should complete the task BUT: Top most OR / And the Win32 Api call will work only inside Visual Studio (well, for Vista and VS2008 I tested it ... I can not tell others). Try to run the program using .Exe from the / bin directory, it will work.

+11
source share

The Form.TopMost property sets your form in the upper form above all other Windows applications (not just your forms).

 myForm.TopMost = true; // This will do the job 
+6
source share

The TopMost property is what you need (there has never been a problem with this)


MSDN says:

The uppermost form is a form that overlaps all other (not the topmost) forms, even if it is not an active or foreground form. The topmost shapes are always displayed at the highest point in the z-order of windows on the desktop.

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.topmost.aspx

+1
source share

On my team, we had an internal tool that continues to work after starting Windows. This is WinForm with the TopMost function. In Vista, we had the same problem. In very random moments, the form will lose the TopMost property, and another non-top window may appear above it. I had a research journal, but I could not find the answer, and many others had the same problem, it seems that Vista has a very low level error in the TopMost property.

0
source share

All Articles