//funcion para abrir formularios
        private void AbrirFormenPanel <formulario>() where formulario : Form, new()
        {
            Form formulariohijo;

            formulariohijo = panelcontenedor.Controls.OfType <formulario>().FirstOrDefault();
            if (formulariohijo == null)
            {
                formulariohijo          = new formulario();
                formulariohijo.TopLevel = false;
                formulariohijo.Dock     = DockStyle.Fill;
                this.panelcontenedor.Controls.Add(formulariohijo);
                this.panelcontenedor.Tag = formulariohijo;
                formulariohijo.Show();
            }
            else
            {
                formulariohijo.BringToFront();
            }
        }
Exemple #2
0
        private void abrir_form <formulario>() where formulario : Form, new()
        {
            Form form1;

            form1 = P_formularios.Controls.OfType <formulario>().FirstOrDefault();

            if (form1 == null)
            {
                form1          = new formulario();
                form1.TopLevel = false;
                form1.Dock     = DockStyle.Fill;
                P_formularios.Controls.Add(form1);
                P_formularios.Tag = form1;
                form1.Show();
                form1.BringToFront();
            }
            else
            {
                form1.BringToFront();
            }
        }