Click here to Skip to main content
15,886,872 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
halo,

i have a mdi parent my mdi parent are contain menustrip and when i click one of the menustripitem will be call or popup one of form child.

i m setting up a background image to my mdi parent.
when i import the image the is no problem appear.i can set and change the background image.

the problem appear when i run my project and the background image always on top to all of my form child. means i cannot event see my form child during run time if i set the mdi parent background as image.

how can i fix this problem?
i just want to set the mdiForm background and when i click menustripitem i can see my form child popup. that all..

i asking the expert to explaint to me...

thank you very much
Posted

1 solution

This is not so easy and probably requires P/Invoke, like finding MDI client window handle via raw Windows API handling WM_ERASEBKGND message. For some background: the real parent (from the stand point of Windows API parent-child relationship at the level of Windows handles), the MDI children are hosted not by the window representing MDI parent, but by its child window called "MDI client". I know it because I was careless enough to get into all this mess years ago, well before .NET. I don't think this detail is directly exposed to .NET FCL. This is just one of many reasons why MDI is never used in more or less professional development.

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA
 
Share this answer
 
Comments
JOE Heart Under Blade 14-Nov-13 20:54pm    
thanks for the advice sir...
so if i want to develope my project, what is the proper way i use if i reject using MDI?
Sergey Alexandrovich Kryukov 14-Nov-13 23:28pm    
The simplest and one of the neatest would be TabConrol, each tab page instead of MDI child window. Much more convenient for the users and yet a lot simpler for implementation. Other ideas you can find in the answers I referenced above: most advanced is may be docking system, AvalonDoc is one of the best implementation, and it could be panels showing or hiding (say, showing one panel at a time) and they can be navigated by list box, tree view, menu, etc.
—SA
JOE Heart Under Blade 15-Nov-13 0:23am    
thank you very much sir... i got what do you mean and i have try it out and i think is similar to the MDI doing.
thank u.
Sergey Alexandrovich Kryukov 15-Nov-13 1:00am    
Logically, it's very, very similar, but UI is different. And more convenient.
Good luck, call again.
—SA

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