How to float window over application properly
-
I am sure there is a simple way to do this, but heck if I can figure it out tonight. Does anyone know of a way to float a child Form (say tool window) in an application properly? I have a main Form, and I create a new child Form (tool window) with a parent of null and TopMost set to true. This allows my tool window to float over the app nicely. The problem is when I switch to another application, my toolwindow is still staring me in the face since it is TopMost! How can I make it float topmost only when the application is active? Is there a way to distinguish between the application losing activation because the user switched to another app or because they clicked on the child tool window (which causes a deactivate)? Any ideas would be greatly appreciated! Michael Developer, Author, Chef
-
I am sure there is a simple way to do this, but heck if I can figure it out tonight. Does anyone know of a way to float a child Form (say tool window) in an application properly? I have a main Form, and I create a new child Form (tool window) with a parent of null and TopMost set to true. This allows my tool window to float over the app nicely. The problem is when I switch to another application, my toolwindow is still staring me in the face since it is TopMost! How can I make it float topmost only when the application is active? Is there a way to distinguish between the application losing activation because the user switched to another app or because they clicked on the child tool window (which causes a deactivate)? Any ideas would be greatly appreciated! Michael Developer, Author, Chef
Reset
TopMost
back tofalse
and set theOwner
property of your floating window to the main application form. See theForm.Owner
property documentation in the .NET Framework SDK for more information.Microsoft MVP, Visual C# My Articles
-
Reset
TopMost
back tofalse
and set theOwner
property of your floating window to the main application form. See theForm.Owner
property documentation in the .NET Framework SDK for more information.Microsoft MVP, Visual C# My Articles
Bah! I knew I was overlooking something simple, but was too brain-fried last night to come up with it. Many thanks again for input Heath! Michael Developer, Author, Chef