Click here to Skip to main content
11,581,982 members (75,593 online)
Rate this: bad
good
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;
            MdiChild.Show();
Posted 28-Dec-11 9:16am
Edited 28-Dec-11 9:20am
v2
Rate this: bad
good
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.
  Permalink  
Comments
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
good
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:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to Create MDI Parent Window in WPF?[^].

Good luck,
—SA
  Permalink  
v3
Comments
   
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...
--SA
Dave Kreskowiak at 17-Apr-15 19:17pm
   
Never mind, this is an old question that got resurrected by some idiot.
Sergey Alexandrovich Kryukov at 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.
—SA
Dave Kreskowiak at 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 at 17-Apr-15 20:06pm
   
Sure. But may be this particular solution, #6, was a good idea. :-)
—SA
Dave Kreskowiak at 17-Apr-15 21:52pm
   
On which planet? :)
Sergey Alexandrovich Kryukov at 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.
—SA
Dave Kreskowiak at 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 at 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.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Try ZOrder method. See if this helps, http://support.microsoft.com/kb/168850[^]
  Permalink  
Comments
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
good
Please Sign up or sign in to vote.

Solution 6

Try this:
Form2.ShowDialog(Me);
  Permalink  
v2
Comments
Dave Kreskowiak at 17-Apr-15 19:18pm
   
Do NOT reply to 3 year old questions.

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

  Print Answers RSS
0 OriginalGriff 320
1 Sergey Alexandrovich Kryukov 185
2 virusstorm 109
3 Frankie-C 105
4 F-ES Sitecore 85
0 OriginalGriff 1,273
1 Sergey Alexandrovich Kryukov 900
2 Abhinav S 617
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 21 Apr 2015
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