2

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?" ?

Community
  • 1
  • 1
Mahdi Tahsildari
  • 13,065
  • 14
  • 55
  • 94

2 Answers2

8

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

MgSam
  • 12,139
  • 19
  • 64
  • 95
  • 1
    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`. – MgSam Feb 07 '13 at 06:21
  • Thanks a lot bro. Saved me a lot of trouble (^_^) – Ganesh Kamath - 'Code Frenzy' Oct 07 '16 at 05:54
2

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

user1659922
  • 346
  • 4
  • 15
  • FixedToolWindow and FixedDialog are also acceptable choices. – Scott Chamberlain Feb 05 '13 at 06:58
  • 7
    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: http://stackoverflow.com/a/9588599/945456 – Jeff B Jan 02 '14 at 22:10
  • @JeffBridgman Your method worked, THANK YOU! – Ivandro Jao Oct 05 '18 at 09:18