I'm doing a program with Visual Studio 2015, it's a Windows Form project with a pretty good UI design, which allows you to open a Form
within a Panel
without opening it in a new window. That causes me a problem, because for example, when I want to open a Form
and inside it with a button open another Form
, I can not find a way to do it, why can not hide or delete the father of the latter?
This is my code:
private void AbrirFormInPanel(object formHijo)
{
if (this.panelContenedor.Controls.Count > 0)
this.panelContenedor.Controls.RemoveAt(0);
Form fh = formHijo as Form;
fh.TopLevel = false;
fh.FormBorderStyle = FormBorderStyle.None;
fh.Dock = DockStyle.Fill;
this.panelContenedor.Controls.Add(fh);
this.panelContenedor.Tag = fh;
fh.Show();
}