Maximize MDI child form

前端 未结 5 1443
半阙折子戏
半阙折子戏 2021-01-02 07:34

I\'m working on a legacy WinForms MDI application and have some trouble making the child forms behave as I want. My objective is to have the child form always maxim

5条回答
  •  萌比男神i
    2021-01-02 08:31

    The problem wasn't easy to solve, but I accidentally found the answer and it's quite simple; set the windowstate of the child form to Normal by default. Then make sure that you reset the windowstate of the child window AFTER you call the Show() method.

    Example:

    private void ShowNewForm(object sender, EventArgs e)
    {
      Form childForm = new Form();
      childForm.MdiParent = this;
      childForm.Text = "Window " + childFormNumber++;
      childForm.Show();
      childForm.WindowState = FormWindowState.Maximized;
    }
    

提交回复
热议问题