Preventing Winform from being maximized?

前端 未结 9 1869
迷失自我
迷失自我 2020-12-06 18:02

I want to prevent my desktop application from being maximized. It should not become maximized by any means - by double clicking on title bar, or by clicking Windows + Up arr

相关标签:
9条回答
  • 2020-12-06 18:54

    You can try to RegisterHotKey Win+Up if your window or application is activated and unregister this hot key if it is deactivated. You must catch the hotkey and return appropriate value to prevent further processing.

    Look at WM_ACTIVATEAPP, WM_ACTIVATE and WM_NCACTIVATE. The first can be used if you want to disable the Win+UP for all your windows.

    0 讨论(0)
  • 2020-12-06 18:55

    Set formborderstyle to fixedsingle

    Maximizebox=false
    

    Set the maximumsize to the size of winform's default size

    Ex: if size(646,385) then set maximumsize(646,385)

    0 讨论(0)
  • 2020-12-06 19:03

    Setting the MaximumSize equal to the Size (or some size) at least stops the windows from going full-screen. It still snaps to the top left corner but it's still a window at least and looks right - like it's Windows being stupid instead of your program.

    0 讨论(0)
提交回复
热议问题