"Doubts" C # parent Form SubformThis question I learned at that time also puzzled for a long, today saw someone asked to explain the next ~ "Ask" the parent form calls the subform, how to display the subform close the parent form? "Answer" in the case of no thread, the main form can not be closed, a closed program exits, should be hidden, provides two ways: The simplest way: "Parent form plus"
Form2 F2 = new Form2 ();
F2. Show ();
This. Hide ();
"Expand" because the main form is just hidden, not the real sense of closing application.exit (); App exit
————————————————————
Common methods: (This method, when you close the subform also returns the parent form)
"Add in parent form"
Form2 F2 = new Form2 ();
F2. ShowDialog (this);//treat the current form as a message box
"Add in Subform"
Loading time: this. Owner.hide (); Parent form Hidden
When it is closed: this. Owner.show (); The parent form displays
Prevent you do not understand, I did 2 examples, the source code is as follows: Http://pan.baidu.com/s/1jG42pee
Feel the Space ~ ~ to contribute a few resources it ~
C#winform instance HTTP://PAN.BAIDU.COM/S/14CGHG;
Do you love me-source Http://pan.baidu.com/s/1gd3RG8F
C # Calculator-source Http://pan.baidu.com/s/1dD4C2zB
Socket Network Programming Client source + Server source code Http://pan.baidu.com/s/1dDkZB9Z
Process-oriented, flying chess game source Http://pan.baidu.com/s/1hql88IC
01. Manually create your own easy browser-source HTTP://PAN.BAIDU.COM/S/1BNGQOSN
02. Manually create two-dimensional code automatic generator-source Http://pan.baidu.com/s/1jGl46kI
03. Manually create your own picture viewer-source Code Http://pan.baidu.com/s/13vSXC 04. Create a lottery draw name System--source code Http://pan.baidu.com/s/1sjudRUt
05. Manually build your own simplified-source http://pan.baidu.com/s/1eQCbo9k
06. Build your own MD5 encryption gadget-source Http://pan.baidu.com/s/1pJLmraj 07. Build Your own C # Remote control series software Http://pan.baidu.com/s/1qWFKJhU more continue to see my little white C # The WinForm series is OK ~ ~
"Doubts" C # parent Form Subform