I have 2 WinForm in Form1 i have Panel and i load Form2 inside Panel(in Form1)
My code for open From2 inside Panel1
Form2 f = new Form2(); f.TopLevel = false; panel1.Controls.Add(f); f.Show();
In Form2 i have button for close the Form and hide the Panel , i can close the Form2 but i can't hide the Panel1
You can subscribe to the Form.Closed
event on Form2. Here you can add code for hiding the panel.
Form2 f = new Form2();
f.TopLevel = false;
f.FormClosed += Form2_FormClosed; //Add this line
panel1.Controls.Add(f);
f.Show();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.