Disable maximize / minimize on Form's double click
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
Related videos on Youtube
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, 2022Comments
-
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 onDouble 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 over 11 yearsFixedToolWindow and FixedDialog are also acceptable choices.
-
MgSam over 11 yearsTo 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
andMinimumSize
. -
Jeff B over 10 yearsAlthough
FixedToolWindow
ironically will maximize when double-clicking the title bar (yes, even though it's "fixed" in size). You have to set theMaximizeBox
property tofalse
to turn off that functionality. See: stackoverflow.com/a/9588599/945456 -
Ganesh Kamath - 'Code Frenzy' over 7 yearsThanks a lot bro. Saved me a lot of trouble (^_^)
-
Ivandro Jao over 5 years@JeffBridgman Your method worked, THANK YOU!