Ejemplo n.º 1
0
        private void Button_ShowNewForm(object sender, EventArgs e)
        {
            Form   childForm = null;
            Button m         = (Button)sender;

            switch (m.Tag)
            {
            case "Home":
                panelShown.Height = btnHome.Height;
                panelShown.Top    = btnHome.Top;
                this.panel2.Controls.Clear();
                childForm          = new Home(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;

            case "Reservations":
                panelShown.Height = btnCreateReservation.Height;
                panelShown.Top    = btnCreateReservation.Top;
                this.panel2.Controls.Clear();
                childForm          = new Reservations(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;

            case "ViewReservation":
                panelShown.Height = btnReservationsList.Height;
                panelShown.Top    = btnReservationsList.Top;
                this.panel2.Controls.Clear();
                childForm          = new ReservationView(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;
            }

            if (childForm != null)
            {
                foreach (Form f in this.MdiChildren)
                {
                    if (f.GetType() == childForm.GetType())
                    {
                        f.Activate();
                        return;
                    }
                }

                //childForm.MdiParent = this;
                childForm.Show();
            }
        }
Ejemplo n.º 2
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = null;

            ToolStripMenuItem m = (ToolStripMenuItem)sender;

            switch (m.Tag)
            {
            case "Reservations":

                this.panel2.Controls.Clear();
                childForm          = new Reservations(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;

            case "ViewReservation":
                this.panel2.Controls.Clear();
                childForm          = new ReservationView(this);
                childForm.TopLevel = false;
                this.panel2.Controls.Add(childForm);
                break;
            }

            if (childForm != null)
            {
                foreach (Form f in this.MdiChildren)
                {
                    if (f.GetType() == childForm.GetType())
                    {
                        f.Activate();
                        return;
                    }
                }

                //childForm.MdiParent = this;
                childForm.Show();
            }
        }