Maximize MDI child form

前端 未结 5 1450
半阙折子戏
半阙折子戏 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条回答
  •  遥遥无期
    2021-01-02 08:15

    This is how I overcame the same promblem, cannot remember where I found the code.

    private const int WM_SYSCOMMAND = 0x112;
    private const int SC_MINIMIZE = 0xF020;
    private const int SC_MAXIMIZE = 0xF030;
    private const int SC_CLOSE = 0xF060;
    private const int SC_RESTORE = 0xF120;
    
    protected override void WndProc(ref Message msg)
    {
      if ((msg.Msg == WM_SYSCOMMAND) && 
        (((int)msg.WParam == SC_MINIMIZE) || ((int)msg.WParam == SC_MAXIMIZE) ||
        ((int)msg.WParam == SC_CLOSE)) || ((int)msg.WParam == SC_RESTORE))
        {
          //do nothing
        } // end if
        else
        {
          base.WndProc(ref msg);
         } // end else
    }
    

提交回复
热议问题