How to open a new form window within same window in C#?
I am making an application in C#, and it has a menu, having forms linked with it, i want tha开发者_运维问答t 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
Your Form(Window) must be MDI
YourForm.IsMdiContainer = True
NewForm.MdiParent = YourForm;
NewForm.Show();
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);
精彩评论