Reputation: 443
I am making an application in C#, and it has a menu, having forms linked with it, i want that there should be a parent form, having a panel or window, when we click on any menu link, its .cs form should be loaded in the window, and so we can click on other windows, and their forms should replace the current one. Just like a common windows software.
Regards Touseef Khan
Upvotes: 1
Views: 10555
Reputation: 43
Try this:
var f2 = new Form2();
f2.TopLevel = false;
f2.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f2.Size = this.Size;
f2.BringToFront();
f2.Visible = true;
this.Controls.Add(f2);
Upvotes: 0
Reputation: 3032
Your Form(Window) must be MDI
YourForm.IsMdiContainer = True
NewForm.MdiParent = YourForm;
NewForm.Show();
Upvotes: 3