Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi.. using visual studio 2013
i wanted to open child form in parent window and i f one click parent window child form should close. How to code for this
Posted
Comments
Sergey Alexandrovich Kryukov 29-Jul-15 2:30am    
So, window or form? Most likely, none of then is a child of another one, so the question does not make sense. Besides, your design idea really sounds bad.

You have to formulate everything correctly and in detail. Code sample, as short as possible, focused only on one problem, and yet 100% self-contained and comprehensive, can help a lot.

—SA
Anne Juliet 29-Jul-15 2:38am    
give you short example... i have one mdi form size 786 X 666 and the child form inside menu which is of size say 320 X 210 ...now if user click out side the area of child form that is area of mdi form then child form should close..that it i shall post images..as soon as possible

https://drive.google.com/open?id=0B1-HOFYAXyneRUV1T2lwQnphSE0
Sergey Alexandrovich Kryukov 29-Jul-15 10:08am    
Ah, if it's MDI, then right, they are MDI children. Without mentioning "MDI", your question did not make much sense. But now, my main advice would be: never use MDI. Why torturing yourself and scaring off your users?
—SA
Anne Juliet 29-Jul-15 3:32am    
give you short example... i have one mdi form size 786 X 666 and the child form inside menu which is of size say 320 X 210 ...now if user click out side the area of child form that is area of mdi form then child form should close..that it i shall post images..as soon as possible

https://drive.google.com/open?id=0B1-HOFYAXyneRUV1T2lwQnphSE0

1 solution

Advice #1: never ever design UI this way. From your comment (thank you very much for your clarifications), I can see that you want to close a MDI child form when a use clicks outside of it, in the area of the MDI client not occupied by children. How can you be so hostile to your users? I would understand if you just wanted to demonstrate you mastering of some UI technique, but for real application it would be a disaster. I think it's pretty obvious why.

And my advice #2: never ever use MDI. 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?,
Question on using MDI windows in WPF,
MDIContainer giving error,
How to set child forms maximized, last childform minimized.

—SA
 
Share this answer
 
v2

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