Search code examples
c#winformsmdi

Hide some controls in MDI parent if a child being re-sized


I want to hide some of my controls in my MDI Parent if a child is being maximized or minimized.


Solution

  • try this

    //Form parent
    public frmMenu()
            {
                InitializeComponent();
                pnlHide = panel1;
            }
    
    public static Panel pnlHide= new Panel();
    
    
    //Form Child
    private void frmChiled_Resize(object sender, EventArgs e)
            {
                if (WindowState == FormWindowState.Maximized)
                {
                    frmMenu.pnlHide.Hide();
                }
                else
                {
                    frmMenu.pnlHide.Show();
                }
            }