Exemplo n.º 1
0
        private void AbrirFormEnPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            formulario = panelContenedor.Controls.OfType <Forms>().FirstOrDefault();

            //si el formulario/instancia no existe, creamos nueva instancia y mostramos
            if (formulario == null)
            {
                formulario                 = new Forms();
                formulario.TopLevel        = false;
                formulario.FormBorderStyle = FormBorderStyle.None;
                formulario.Dock            = DockStyle.Fill;
                panelContenedor.Controls.Add(formulario);
                panelContenedor.Tag = formulario;
                formulario.Show();

                formulario.BringToFront();
                formulario.FormClosed += new FormClosedEventHandler(CloseForms);
            }
            else
            {
                formulario.BringToFront();                               //si la Formulario/instancia existe, lo traemos a frente
                if (formulario.WindowState == FormWindowState.Minimized) //Si la instancia esta minimizada mostramos
                {
                    formulario.WindowState = FormWindowState.Normal;
                }
            }
        }
Exemplo n.º 2
0
        private void AbrirFormNoPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            formulario = panelConteudo.Controls.OfType <Forms>().FirstOrDefault();

            if (formulario == null)
            {
                formulario          = new Forms();
                formulario.TopLevel = false;
                //formulario.FormBorderStyle = FormBorderStyle.None;
                //formulario.Dock = DockStyle.Fill;
                panelConteudo.Controls.Add(formulario);
                panelConteudo.Tag = formulario;
                formulario.Show();
                formulario.BringToFront();
            }
            else
            {
                if (formulario.WindowState == FormWindowState.Minimized)
                {
                    formulario.WindowState = FormWindowState.Normal;
                }
                formulario.BringToFront();
            }
        }
Exemplo n.º 3
0
        private void AbrirEnPanel <Forms>() where Forms : Form, new()
        {
            //-----------ABRO O MUESTRO EL FORMULARIO EN EL PANEL CENTRAL-----------
            Form formAbrir = panelContenedor.Controls.OfType <Forms>().FirstOrDefault();

            //si el formulario/instancia no existe, creamos nueva instancia y mostramos
            if (formAbrir == null)
            {
                formAbrir = new Forms
                {
                    TopLevel        = false,
                    FormBorderStyle = FormBorderStyle.None,
                    Dock            = DockStyle.Fill
                };
                panelContenedor.Controls.Add(formAbrir);
                panelContenedor.Tag = formAbrir;
                formAbrir.Show();
                formAbrir.BringToFront();
            }
            else
            {
                //si la Formulario/instancia existe, lo traemos a frente
                formAbrir.BringToFront();
                //Si la instancia esta minimizada mostramos
                if (formAbrir.WindowState == FormWindowState.Minimized)
                {
                    formAbrir.WindowState = FormWindowState.Normal;
                }
            }
        }
Exemplo n.º 4
0
        //Abrir formulario en el panel
        private void AbrirFormEnPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            formulario = panelContenedor.Controls.OfType <Forms>().FirstOrDefault();

            //si el formulario/instancia no existe, creamos nueva instancia y mostramos
            if (formulario == null)
            {
                formulario                 = new Forms();
                formulario.TopLevel        = false;
                formulario.FormBorderStyle = FormBorderStyle.None;
                formulario.Dock            = DockStyle.Fill;
                formulario.Location        = new Point((panelContenedor.Width + panelMenu.Width - formulario.Width) / 2, (panelContenedor.Height + panelBarraTitulo.Height - formulario.Height) / 2);
                formulario.Anchor          = AnchorStyles.None;
                panelContenedor.Controls.Add(formulario);
                panelContenedor.Tag = formulario;
                formulario.Show();

                formulario.BringToFront();
                formulario.FormClosed += new FormClosedEventHandler(CloseForms);
            }
            else
            {
                //si la Formulario/instancia existe, lo traemos a frente
                formulario.BringToFront();

                //Si la instancia esta minimizada mostramos
                if (formulario.WindowState == FormWindowState.Minimized)
                {
                    formulario.WindowState = FormWindowState.Normal;
                }
            }
        }
Exemplo n.º 5
0
        private void AbrirFormEnPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            formulario = panelContenedor.Controls.OfType <Forms>().FirstOrDefault();

            //si el formulario/instancia no existe, creamos nueva instancia y mostramos
            if (formulario == null)
            {
                formulario          = new Forms();
                formulario.TopLevel = false;
                panelContenedor.Controls.Add(formulario);
                panelContenedor.Tag = formulario;
                formulario.Show();
                formulario.Dock = DockStyle.Fill;

                formulario.BringToFront();
            }
            else
            {
                formulario.BringToFront();
                formulario = new Forms();
                if (formulario.WindowState == FormWindowState.Minimized)
                {
                    formulario.WindowState = FormWindowState.Normal;
                }
            }
        }
Exemplo n.º 6
0
        private void AbrirFormNoPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            formulario = pnlConteudo.Controls.OfType <Forms>().FirstOrDefault();

            if (formulario == null)
            {
                formulario = new Forms
                {
                    TopLevel        = false,
                    FormBorderStyle = FormBorderStyle.None,
                    Dock            = DockStyle.Fill
                };

                pnlConteudo.Controls.Add(formulario);
                pnlConteudo.Tag = formulario;

                formulario.FormClosed += new FormClosedEventHandler(ExibeBotoes);
                formulario.Show();
                formulario.BringToFront();
            }
            else
            {
                if (formulario.WindowState == FormWindowState.Minimized)
                {
                    formulario.WindowState = FormWindowState.Normal;
                }

                formulario.BringToFront();
            }
        }
Exemplo n.º 7
0
        public void AbrirFormNoPainel <Forms>() where Forms : Form, new()
        {
            try
            {
                Form formulario;
                formulario = panelDesktop.Controls.OfType <Forms>().FirstOrDefault();

                if (formulario == null)
                {
                    formulario          = new Forms();
                    formulario.TopLevel = false;
                    panelDesktop.Controls.Add(formulario);
                    panelDesktop.Tag = formulario;
                    formulario.Show();
                    formulario.BringToFront();
                }
                else
                {
                    if (formulario.WindowState == FormWindowState.Minimized)
                    {
                        formulario.WindowState = FormWindowState.Normal;
                    }
                    formulario.BringToFront();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro no sistema");
                RegistraLog.Log($"Erro ao tentar abrir janela no Panel principal --- {ex}");
            }
        }
Exemplo n.º 8
0
        //METODO PARA ABRIR FORM DENTRO DE PANEL-----------------------------------------------------
        private void AbrirFormEnPanel <Forms>() where Forms : Form, new()
        {
            Form formulario;

            //busca en la coleccion el formulario
            formulario = panelFormularios.Controls.OfType <Forms>().FirstOrDefault();

            //si el formulario/instancia no existe, creamos nueva instancia y mostramos
            if (formulario == null)
            {
                formulario          = new Forms();
                formulario.TopLevel = false;
                //formulario.FormBorderStyle = FormBorderStyle.None;
                //formulario.Dock = DockStyle.Fill;
                panelFormularios.Controls.Add(formulario);
                panelFormularios.Tag = formulario;
                formulario.Show();
                formulario.BringToFront();
                // formulario.FormClosed += new FormClosedEventHandler(CloseForms);
            }
            else
            {
                if (formulario.Name == "NCumpleañero")
                {
                    formulario.Close();
                    formulario          = new Forms();
                    formulario.TopLevel = false;
                    //formulario.FormBorderStyle = FormBorderStyle.None;
                    //formulario.Dock = DockStyle.Fill;
                    panelFormularios.Controls.Add(formulario);
                    panelFormularios.Tag = formulario;
                    formulario.Show();
                }
                if (formulario.Name == "FCargo")
                {
                    formulario.Close();
                    formulario          = new Forms();
                    formulario.TopLevel = false;
                    //formulario.FormBorderStyle = FormBorderStyle.None;
                    //formulario.Dock = DockStyle.Fill;
                    panelFormularios.Controls.Add(formulario);
                    panelFormularios.Tag = formulario;
                    formulario.Show();
                }

                //si la Formulario/instancia existe, lo traemos a frente
                formulario.BringToFront();


                //Si la instancia esta minimizada mostramos
                if (formulario.WindowState == FormWindowState.Minimized)
                {
                    formulario.WindowState = FormWindowState.Normal;
                }
            }
        }
Exemplo n.º 9
0
        /// <summary> Change frontmost form if requested to do so. </summary>
        protected virtual void ProcessFormChange(HttpContext context)
        {
            string formIDString = context.Request.QueryString["FormID"];

            if ((formIDString != null) && (formIDString != String.Empty))
            {
                IFormInterface form = GetForm(formIDString);
                if (form != null)
                {
                    Forms.BringToFront(form);
                }
            }
        }
Exemplo n.º 10
0
        public void abrirForm <Forms>() where Forms : Form, new()
        {
            Form formulario = pnlInicioConteudo.Controls.OfType <Forms>().FirstOrDefault();

            if (formulario == null)
            {
                formulario = new Forms
                {
                    TopLevel        = false,
                    FormBorderStyle = FormBorderStyle.None,
                    Dock            = DockStyle.Fill
                };
                pnlInicioConteudo.Controls.Add(formulario);
                formulario.Show();
                formulario.BringToFront();
            }
        }
Exemplo n.º 11
0
        private void OpenForm <Forms>() where Forms : Form, new()
        {
            Form Form0 = Panel1.Controls.OfType <Forms>().FirstOrDefault();

            if (Form0 == null)
            {
                Form0 = new Forms
                {
                    TopLevel        = false,
                    FormBorderStyle = FormBorderStyle.None,
                    Dock            = DockStyle.Fill
                };

                Panel1.Controls.Add(Form0);
                Panel1.Tag = Form0;

                try
                {
                    Form0.Show();
                }
                catch (Exception)
                {
                    Form0.Show();
                }

                Form0.BringToFront();
            }
            else
            {
                Form0.BringToFront();

                if (Form0.WindowState == FormWindowState.Minimized)
                {
                    Form0.WindowState = FormWindowState.Normal;
                }
            }
        }