Reputation: 684
I'm stuck at a problem and the old answers regarding the same problem are not quite recent enough so i thought it'd be okay to ask again. My question is: How can i dock one form inside another form? Would it be more appropriate to use a Panel and a Form instead? Is the first option even possible? Thanks in advance.
Upvotes: 1
Views: 4735
Reputation: 760
Create 2 forms, Form1 and Form2. Set TopLevel property of Form2 to false. In form load for Form1 add code
private void Form1_Load(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
this.Controls.Add(frm2);
}
This will include form2 in form1, you then have to set properties on form2 if you want to remove the title bar to make the form more like a Panel.
Upvotes: 6
Reputation: 4428
If you want to have some reusable panel that may be used on forms I think User Control will be what you are looking for.
Upvotes: 1