Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to float window over application properly

How to float window over application properly

Scheduled Pinned Locked Moved C#
questionhelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Wolski
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • M Michael Wolski

      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

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Reset TopMost back to false and set the Owner property of your floating window to the main application form. See the Form.Owner property documentation in the .NET Framework SDK for more information.

      Microsoft MVP, Visual C# My Articles

      M 1 Reply Last reply
      0
      • H Heath Stewart

        Reset TopMost back to false and set the Owner property of your floating window to the main application form. See the Form.Owner property documentation in the .NET Framework SDK for more information.

        Microsoft MVP, Visual C# My Articles

        M Offline
        M Offline
        Michael Wolski
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups