Minimize Form Together with Parent Form

I have made use of the MDI, I realized that the children forms called from the parent form is minimized together with main form and however when i call a new form from a children form, a design problem which this new form can't be minimized together with main may appear How to make their minimize and maximize properties to be consistent Thank you.

Answer this question

Minimize Form Together with Parent Form

  • Nayan Paregi

    Please be explicit when you say "doesn't work properly".


  • HSBF Lewe

    This will happen when you don't make the form an MDI child and don't set the owner. Use the Show() method overload that takes the owner argument. For example:

    private void toolStripButton2_Click(object sender, EventArgs e) {
    Form2 f2 = new Form2();
    f2.Show(this);
    }

    If you call this from an MDI child window, pass "this.MdiParent" instead.


  • billb59

    I have one Main Windows which consists of ToolStripMenu, i can link to another form called form2 from the ToolStripMenu. There is another button in form2, which it is used to link to form3, but i want to set the form2 as a child under Main Windows so it can be minimized and maximized together under one form. I tried to achieve it using the following code but it doesn't work. Nothing is shown out when i click on it, may i know why Thank you.
     

    Dim child As New form2

    form2.MdiParent = Main_Windows

    form2.Show()


  • GroZZleR

    hi I have tried this example that contain two form
    parent form contain maun can generate a child form
    namespace WindowsApplication2
    {
    public partial class MDI_M :
    Form
    {
    public MDI_M()
    {
    InitializeComponent();
    }
    private void addToolStripMenuItem1_Click(object sender, EventArgs e)
    {
    Child cd = new Child();
    cd.MdiParent = this;
    cd.Show();
    }
    }
    }
    and the child form contain one button while click can pop another child form:
    namespace WindowsApplication2
    {
    public partial class Child :
    Form
    {
    public Child()
    {
    InitializeComponent();

    }

    private void button1_Click(object sender, EventArgs e)
    {
    Child cd2 = new Child();
    cd2.MdiParent = this.MdiParent;
    cd2.Show();
    }
    }
    }


  • ved_30

    I have tried the following code but it still doesn't work properly, may i know why Thank you.
    Dim DisplayForm As New emp_pro_f
    DisplayForm.Show(Me.MdiParent)
    Me.Close()

  • Minimize Form Together with Parent Form