PDA

Click to See Complete Forum and Search --> : Bringing All Forms Back To Front


Blue_Wolf101
Mar 21st, 2011, 03:53 AM
In VB6, if you have multiple windows forms open as part of one project, if you click one form, it brings all of them back into focus.

However in .NET it seems to only bring back the one form you click on.

Is there any way to replicate this behaviour in .NET so that it brings all of them back?

boops boops
Apr 5th, 2011, 12:41 PM
Probably this post doesn't belong in the Architecture forum, but it's easy to answer. Make the main form the Owner of all the other forms. For example, set their Owner property (in code) to the main form. There are other ways such as the Form.AddOwnedForm method and Form.Show(owner). The result is that the Owned forms always stay in front of their Owner. BB

jmcilhinney
Apr 5th, 2011, 11:46 PM
Probably this post doesn't belong in the Architecture forum, but it's easy to answer. Make the main form the Owner of all the other forms. For example, set their Owner property (in code) to the main form. There are other ways such as the Form.AddOwnedForm method and Form.Show(owner). The result is that the Owned forms always stay in front of their Owner. BBThat's not the same behaviour as VB6.

I was thinking that you might be able to hack something by setting the TopMost property of each form and then resetting it. You'd have to know the z-order then though, which would probably require API calls.