Disable maximize / minimize on Form's double click

16,720

Solution 1

You can set the MaximumSize and MinimumSize. If they both equal the same thing it should prevent the form from changing size.

Solution 2

if you can set FormBorderStyle from None to FixedSingle or Fixed3D it will prevent form maximixe on double click

Share:
16,720

Related videos on Youtube

Mahdi Tahsildari
Author by

Mahdi Tahsildari

Love programming, it's fun. MCP since 2011. C#, ASP.net MVC Core, SQL; NodeJs, Angular, HTML, CSS, Javascript. Currently focused on ASP.Net Core and Unit Testing.

Updated on June 21, 2022

Comments

  • Mahdi Tahsildari
    Mahdi Tahsildari almost 2 years

    Possible Duplicate:
    How can I stop a double click of the window title bar from maximizing a window of FormBorderStyle.FixedToolWindow?

    I have a form which I've removed the minimize and maximize buttons from, set the FormBorderStyle to none, added drag & drop behaviour, but I want my form size to be static. Now form maximizes/minimizes on Double Click.

    I searched but didn't find relevent answers, questions I came up with were about disabling minimize & maximize buttons.

    I there a way that I tell my form "Hei, would you ignore double click and maintain your size please?" ?

  • Scott Chamberlain
    Scott Chamberlain over 11 years
    FixedToolWindow and FixedDialog are also acceptable choices.
  • MgSam
    MgSam over 11 years
    To me, there's nothing about a Window's border that should dictate its size constraints. A border is only one possible way of maximizing/minimizing. It seems "hackier" to use that than to use MaximumSize and MinimumSize.
  • Jeff B
    Jeff B over 10 years
    Although FixedToolWindow ironically will maximize when double-clicking the title bar (yes, even though it's "fixed" in size). You have to set the MaximizeBox property to false to turn off that functionality. See: stackoverflow.com/a/9588599/945456
  • Ganesh Kamath - 'Code Frenzy'
    Ganesh Kamath - 'Code Frenzy' over 7 years
    Thanks a lot bro. Saved me a lot of trouble (^_^)
  • Ivandro Jao
    Ivandro Jao over 5 years
    @JeffBridgman Your method worked, THANK YOU!