none
HOW TO ADD BUTTON TO MDI FORM PROBLEM

Answers

  • Hi Kevin,

    Base on my understanding, the controls on parent form always have the higher z-order which will display over the child forms.

    If you want to hide the controls (Label and Button) on parent form, I think you need to set Visible property to them.

                foreach (Control c in this.Controls)
                {
                    Button btn = c as Button;
                    if (btn != null)
                    {
                        btn.Visible = false;
                    }
    
                    Label lbl = c as Label;
                    if (lbl != null)
                    {
                        lbl.Visible = false;
                    }
                }
    

    You can check in Form_Closed event whether this is the only Mdi child form. If so, you can make the controls visible.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, September 24, 2012 7:57 AM
  • Move your buttons into another child form or tool bar.

    You should avoid placing controls onto an MDIForm directly. 

    It's not what MDIForms are meant for and, as you've discovered, it doesn't work very well.



    Regards, Phill W.

    Wednesday, September 26, 2012 12:20 PM

All replies

  • when i am adding Controls to mdi form..It overlaps to the child control...

    HOW TO AVOID IT.

    Pls help me....

    Friday, September 21, 2012 1:21 PM
  • Hi Kevin,

    Base on my understanding, the controls on parent form always have the higher z-order which will display over the child forms.

    If you want to hide the controls (Label and Button) on parent form, I think you need to set Visible property to them.

                foreach (Control c in this.Controls)
                {
                    Button btn = c as Button;
                    if (btn != null)
                    {
                        btn.Visible = false;
                    }
    
                    Label lbl = c as Label;
                    if (lbl != null)
                    {
                        lbl.Visible = false;
                    }
                }
    

    You can check in Form_Closed event whether this is the only Mdi child form. If so, you can make the controls visible.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, September 24, 2012 7:57 AM
  • Move your buttons into another child form or tool bar.

    You should avoid placing controls onto an MDIForm directly. 

    It's not what MDIForms are meant for and, as you've discovered, it doesn't work very well.



    Regards, Phill W.

    Wednesday, September 26, 2012 12:20 PM