Form inside of another form

  • Thread starter Thread starter Wellington Eliel Lopes
  • Start date Start date
W

Wellington Eliel Lopes

Hi people,

I´m newbie in .NET and I´m using Visual C++.
Can I to insert a windows form inside of another windows form like a panel?

Thanks for help!


Wellington Eliel Lopes
 
Try something like this (in C#)...

Form2 f = new Form2();
f.TopLevel = false;
this.panel1.Controls.Add(f);
f.Show();

In addition, since the title bar will show up, you might also want to add
the following line...

f.FormBorderStyle = FormBorderStyle.None;

Is it absolutely necessary to keep the functionality within a Form, or could
you design this as a UserControl instead?
 
Wellington Eliel Lopes said:
I´m newbie in .NET and I´m using Visual C++.
Can I to insert a windows form inside of another windows form like a
panel?

You may want to use a usercontrol (composite control) instead of an embedded
form. Usercontrol can be added to a project by selecting "Project" -> "Add
UserControl...".
 
You may want to use a usercontrol (composite control) instead of an
embedded
form. Usercontrol can be added to a project by selecting "Project" -> "Add
UserControl...".

I can second that. This is far the easiest way.

PeterV
 
Back
Top