Click here to Skip to main content
13,050,450 members (88,572 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 9:16am
Updated 28-Dec-11 9: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 28-Dec-11 15:25pm
How about if i want to do that??!! Isn't any way?
Mika Wendelius 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 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 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...
Dave Kreskowiak 17-Apr-15 19:17pm
Never mind, this is an old question that got resurrected by some idiot.
Sergey Alexandrovich Kryukov 17-Apr-15 19:45pm
No problem, but I don't think "resurrection" of old post is always idiotic. Truth does not have expiration date on it. And MDI is not completely in the trash bins. If someones find some mistakes in one's own post, it's better to fix it than not to. (I don't mean this particular post). I don't know why there is so much buzz about "old".
Thank you.
Dave Kreskowiak 17-Apr-15 20:03pm
I know that, but Solution 6 is what did it. Take a peek at that and....yeah.
Sergey Alexandrovich Kryukov 17-Apr-15 20:06pm
Sure. But may be this particular solution, #6, was a good idea. :-)
Dave Kreskowiak 17-Apr-15 21:52pm
On which planet? :)
Sergey Alexandrovich Kryukov 17-Apr-15 22:55pm
The same planet where it recently gone. :-)
Jokes aside, we don't know what the inquirer really wanted, so the idea to just show modal form could be it.
Dave Kreskowiak 17-Apr-15 23:03pm
I know what he was doing and why it didn't work. The MdiClient control, by default, is always Docked Full and sits last in the control Z-Order. You have to jump through some hoops to grab the MdiClient control, undock it, move it around, or put it into another container, or a TableLayoutPanel, or whatever.

It's a bit of a pin, but... I really never had a use for the stupid MDI thing. It's not like I wanted to ever write a multi-document Notepad! :)
Sergey Alexandrovich Kryukov 17-Apr-15 23:10pm
I used MDI in the past, and even did tricky things such as the background images on the MDI client (which is not children; it is an internal client part of MDI parent, the background for children). And this is the exact reason why I recommend never ever get into it: I just know how much this stupid thing rotten. And of course, it does irritates the users.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Try ZOrder method. See if this helps,[^]
Mika Wendelius 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 6

Try this:
Dave Kreskowiak 17-Apr-15 19:18pm
Do NOT reply to 3 year old questions.
Jack-tek460 19-Aug-16 2:51am
Thanks cami10 for replying to this old post. Your solution is so simple and works great!!! …save me many hours, if not days

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 21 Apr 2015
Copyright © CodeProject, 1999-2017
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