Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# .NET C#4.0
Hi all..
I have big problem. I have a main form and another form which i want to use as a childmdi. i did that and it works. but the problem is that when the mdiChild appears, it goes behind of other controls. how can i fix that?
Here is my code:
            Form2 MdiChild = new Form2();
            MdiChild.MdiParent = this;
Posted 28-Dec-11 10:16am
Edited 28-Dec-11 10:20am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Sounds like you have drawn controls on the MDI parent. If that is true, you should never do that. Controls are always placed on MDI children excluding status bar, menu bar etc.
alizadeh91 at 28-Dec-11 15:25pm
How about if i want to do that??!! Isn't any way?
Mika Wendelius at 28-Dec-11 15:55pm
If I recall correctly, no. Basically you could hide the controls when a child form is shown but still you would have some trouble. What if part of the control drawn on MDIParent should be visible and so on.
If these controls on the MDIParent's area which is reserved for child forms is the problem, I think you should consider redesigning the UI.
alizadeh91 at 28-Dec-11 16:20pm
Ok.Thanks :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Look, listen to a good friendly advice: stop torturing yourself and chasing out your users with that MDI nonsense. Nearly everyone discourages it, and Microsoft worked hard to phase this thing out. Finally, MDI was not included in WPF even though it remains in System.Windows.Forms, presumably for compatibility with legacy code, but highly discouraged even by Microsoft where this concept was created.
There are many robust conceptions; the simplest one is the tabbed UI based on TabControl.
Please see:[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to Create MDI Parent Window in WPF?[^].
Good luck,
MDI is perfectly viable. Just because Microsoft isn't behind it anymore doesn't mean squat. Look at all the other stuff they've abandoned - Silverlight - WinForms - C++ - unmanaged development...
SAKryukov at 30-Dec-11 10:30am
I agree with other stuff and partially agree with MDI -- it is viable and applicable. Formally. But in practice, I cannot see any single reason to use it, ever. Harder to develop (if one needs minimal flexibility), awkward to use.
I never mind using "old" technologies -- they can be better then "new" and "trendy", and I almost hate the idea of using anything "cool", but there are considerations other than that. MDI was bad at the moment of its creation.
Also, I don't see that Slverlight, Forms, unmanaged C++ were abandoned...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this:
EDIT ============================
Try this, then:
(Using intellisense will save you buttloads of time.)
EDIT #2 =========================
BTW, did you set your parent form's IsMDIContainer property to true?
alizadeh91 at 28-Dec-11 15:19pm
Sorry it doesn't work!!!
John Simmons / outlaw programmer at 28-Dec-11 15:25pm
Check my answer again.
alizadeh91 at 28-Dec-11 15:46pm
No it doesn't worked anyway. BringToFront bring a form to front relative to other windows forms(not it container).
Yes i made it true.
John Simmons / outlaw programmer at 28-Dec-11 17:08pm
Then your app needs to be refactored. Do you even know how MDI is supposed to work?
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Try ZOrder method. See if this helps,[^]
Mika Wendelius at 28-Dec-11 16:25pm
That's quite far fetched, the bug applies to VB 5. But on the other hand, you'll never know...
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

Although This question asked 1 year ago,i answer this.because it is question of many programmer.
thats so simple,you can do a trick and put all your controls on a child form and call that in mdi load event and whenever you want.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Zoltán Zörgő 220
1 Peter Leow 160
2 CPallini 120
3 CHill60 100
4 BillWoodruff 95
0 Sergey Alexandrovich Kryukov 9,428
1 OriginalGriff 6,901
2 Peter Leow 4,737
3 Zoltán Zörgő 4,349
4 CHill60 2,932

Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100