How to disable the minimize button in C#?

后端 未结 8 879
花落未央
花落未央 2020-12-06 13:33

In my application I need to temporarily gray out the minimize button of the main form. Any ideas how this can be achieved? I don\'t mind doing p/invokes to Win32 dlls.

8条回答
  •  清歌不尽
    2020-12-06 13:56

    Put this code in your form's Resize event:

    if (this.WindowState == FormWindowState.Minimized)
    {
        this.WindowState = FormWindowState.Normal;
    }
    

    This will make your form un-minimizable (DISCLAIMER: I do not advocate altering the standard behavior of windows in this way).

提交回复
热议问题