Cómo encontrar el formulario maestro y adjuntar un niño

I use MDI in MainForm.cs

 public Le_MainForm()
        { 
            InitializeComponent();
            this.IsMdiContainer = true;
            this.Name = "MainUSER";

        }

 private void barButtonItem_ListeOrdres_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Close_AllForm();
            Liste_Ordres f_Liste = new Liste_Ordres();
            f_Liste.MdiParent = this;
            f_Liste.Show();
        }

        private void barButtonItem_CreatOrdreAller_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Close_AllForm();
            Program.AllerRetour = "Ordre Aller";
            Fiche_Ordre f_Fiche = new Fiche_Ordre();
            f_Fiche.MdiParent = this;
            f_Fiche.Show();
        }

the question now, when I am in other form Ex.:Liste_Ordres.cs or Fiche_Ordre.cs how can i redirect from Fiche_Ordre.cs into Liste_Ordres.cs and vice versa without loosing MDI ?

When I'm in Fiche_Ordres.cs to go to Liste_Ordres.cs I use:

private void simpleButton_Annluer_Click_1(object sender, EventArgs e)
        {
            Liste_Ordres f_Liste = new Liste_Ordres();

            f_Liste.Show();
            this.Close();
        }

But as you can see I lose the MDI, that mean when I click the menu on MainForm, the Liste_Ordres form will disappear.

as you can see in this Video that when i redirect From Liste to fiche, and then maximize the window i lose the menu that mean i lose Mdi.

preguntado el 03 de mayo de 12 a las 21:05

1 Respuestas

Solo necesitas configurar el MdiParent nuevo:

f_Liste.MdiParent = this.MdiParent;

contestado el 03 de mayo de 12 a las 21:05

Thanks you for your response, but still when i maximize the window after redirection i lost the menu. you can see on Video. - user609511

In the debugger, what is MdiParent? - SLaks

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.