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. Find which Windows Form is on top

Find which Windows Form is on top

Scheduled Pinned Locked Moved C#
performance
6 Posts 3 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.
  • W Offline
    W Offline
    wrykyn
    wrote on last edited by
    #1

    Hi, I have some MDI children forms that are laid out (sometimes one on top of the other). At a given time, I need to find out which forms are on top and which forms are hidden behind the forms on top. I Iwas wondering if there's some way to do this. I could not find anything online. Thank you, Ramanan

    "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

    N 1 Reply Last reply
    0
    • W wrykyn

      Hi, I have some MDI children forms that are laid out (sometimes one on top of the other). At a given time, I need to find out which forms are on top and which forms are hidden behind the forms on top. I Iwas wondering if there's some way to do this. I could not find anything online. Thank you, Ramanan

      "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello Use MyMDIChildClass.ActiveForm static property.

      Regards:rose:

      W 1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello Use MyMDIChildClass.ActiveForm static property.

        Regards:rose:

        W Offline
        W Offline
        wrykyn
        wrote on last edited by
        #3

        Hi, I can't really use that because I want to also know which inactive forms are on top, and which ones are on the bottom. For instance I can have 8 child forms open in a 2x2 layout with 4 on top and 4 below. I want to know which 4 are on top. Of course, only one of them is active and has focus. But I want to get a list of all 4. Thanks, R

        "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

        N 1 Reply Last reply
        0
        • W wrykyn

          Hi, I can't really use that because I want to also know which inactive forms are on top, and which ones are on the bottom. For instance I can have 8 child forms open in a 2x2 layout with 4 on top and 4 below. I want to know which 4 are on top. Of course, only one of them is active and has focus. But I want to get a list of all 4. Thanks, R

          "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          I don't know if there is a function or a property to get the Z-Order of a form!! You can BringToFront() or SendToBack() but it isn't what you want!! All I can think of is to track your Z-Order manually. When a form is clicked and activated it should update its Z-Order in a static list in the MDIChild class sending all other forms behind. This way you will check the list for the order of forms.

          Regards:rose:

          W 1 Reply Last reply
          0
          • N Nader Elshehabi

            I don't know if there is a function or a property to get the Z-Order of a form!! You can BringToFront() or SendToBack() but it isn't what you want!! All I can think of is to track your Z-Order manually. When a form is clicked and activated it should update its Z-Order in a static list in the MDIChild class sending all other forms behind. This way you will check the list for the order of forms.

            Regards:rose:

            W Offline
            W Offline
            wrykyn
            wrote on last edited by
            #5

            [Message Deleted]

            A 1 Reply Last reply
            0
            • W wrykyn

              [Message Deleted]

              A Offline
              A Offline
              AB7771
              wrote on last edited by
              #6

              i had implemented the same thing using a arraylist WHen a form is opened or clicked it is added to the ArrayList, so u get the forms in the reverse order of the Arraylist. Hope that works for you.

              Thanks & Regards, Pramod "Everyone is a genius at least once a year"

              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