| nobugz wrote: |
You'll have to tighten-up your specification a bit. What do you call "blocked"? If Notepad covers a wee corner of your form, is that blocking? The general approach requires P/Invoking Windows API functions. Use GetWindow(hWnd, GW_HWNDPREV) to find the previous window in the Z-order, use GetWindowRect() on that window to see if it covers your form. Repeat until GetWindow() returns IntPtr.Zero. Use SetForegroundWindow() to move your form to the foreground. That doesn't always work if the previous foreground window is "in use". You can retrieve the required P/Invoke declarations from www.pinvoke.net
| |
Hello nobugz:
Thank you for your comments.
The basic idea why I should know this is as follows:
I need to draw a Figure on top of an application that currently doesn't provide an easy to use Control for me.
So my workaround is to create a Form without border and try to make the new Form tied with the old application and make the new form always on top of all other applications.
However, the drawback of these trick is that the new form cannot perform as same as the old application.
For example:
1> If users minimize all applications on the desktop, the new form will still appear on the desktop.
2> If users open a new application that cover part or full of the UI of the old application, the new form will still be on the top.
I don't think it is a good ideato use this technique. However, currently I don't have other options.
Thank you
-daniel