1
votes

In my application there are two forms.

MDIParentForm
Child form

Child form contains a panel. Here is the code:

private void ChildForm_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState.Equals(FormWindowState.Maximized))
    {
        this.lPanel.Height *= 2;
        this.lPanel.Width *= 2;
    }
if (this.WindowState.Equals(FormWindowState.Normal) 
         || this.WindowState.Equals (FormWindowState.Minimized))
    {
        this.lPanel.Height /= 2;
        this.lPanel.Width /= 2;
    }

}

Now, I maximize the child form. And minimize the MDIParent Form from the task bar. Now when I restore the MDIParent, the Panel (i.e. in the ChildForm) expands to double as in code. Controls in child form must not expand. TIRED OF THIS.

1
This cannot work, the SizeChanged event runs a lot more often than you hope. You'll need to write smarter code. Only expand the panel if the form's ClientSize is big enough. Restore the size when it gets too small.Hans Passant

1 Answers

0
votes