Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C#
Form2 MdiChild = new Form2();
MdiChild.MdiParent = this;
MdiChild.Show();
Posted
Updated 28-Dec-11 9:20am
v2

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.
 
Share this answer
 
Comments
alizadeh91 28-Dec-11 15:25pm    
How about if i want to do that??!! Isn't any way?
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 :)
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
 
Share this answer
 
v3
Comments
#realJSOP 29-Dec-11 5:54am    
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...
Sergey Alexandrovich Kryukov 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 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.
—SA
Dave Kreskowiak 17-Apr-15 20:03pm    
I know that, but Solution 6 is what did it. Take a peek at that and....yeah.
Try ZOrder method. See if this helps, http://support.microsoft.com/kb/168850[^]
 
Share this answer
 
Comments
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...
Try this:
C#
Form2.ShowDialog(Me);
 
Share this answer
 
v2
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900