Example #1
0
        private void AbrirForm <SubForm>() where SubForm : Form, new()
        {
            Form frmChild = new Form();

            frmChild = pnlChildForms.Controls.OfType <SubForm>().FirstOrDefault();

            if (frmChild == null)
            {
                frmChild          = new SubForm();
                frmChild.TopLevel = false;
                frmChild.Dock     = DockStyle.Fill;
                pnlChildForms.Controls.Add(frmChild);
                pnlChildForms.Tag = frmChild;
                frmChild.Show();
                frmChild.BringToFront();
            }
            else
            {
                frmChild.BringToFront();
            }
        }