tags:

views:

738

answers:

5

How do I prevent my form from being resized? I don't want it to be maximized (which can be toggled via the property editor), but I don't want anyone to be able to drag-resize it. Am I missing something simple, or does this require a little bit of coding?

I'm using Delphi 2007.

+3  A: 

You can set the BorderStyle to bsDialog.

Gamecat
+14  A: 

TForm has the property you need. Set

BorderStyle to bsSingle

so that the form doesn't appear to be sizable, and it has the added benefit of actually not being sizable. :-)

Nick Hodges
+1  A: 

You can set the BorderStyle to bsSingle, too. That will give you a proper top level frame, with icon and everything.

mghie
+3  A: 

Don't forget about the Constraint properties of TForm, i.e. MaxHeight, MinHeight, MaxWidth, MinWidth.

Gerard
Also OnCanResize, OnConstrainedResize events.
TOndrej
A: 

And if you want to get really geeky (i.e. the answers above are better), you can intercept the RESIZE Windows message.

I would go with the Constraints property myself.

Cheers

Richard Haven