By Windows design a form (window) has a size constraint that sets the minimum form height to the height of the caption bar and the width to 112 pixels (118 in XP theme).
This minimum size constraint is imposed by Windows to prevent a user from accidentially resizing a window so much that it becomes unusable.
There might be situations where you need to have your forms smaller then 112 pixels in width.
By handling the WM_GETMINMAXINFO Windows message, you can set your own size constraint that are applied when the user is resizing the form (or the size is set programmatically).
Note also you have to "clear" the BorderIcons and the Caption properties of the form in order for this code to work.
type TForm1 = class(TForm) ... private procedure GetMinMaxInfo(var Msg: TWMGETMINMAXINFO) ; message WM_GETMINMAXINFO; ... implementation
Ah, I almost forgot: double check the Constraint property for the form and any of the controls on the form that use client alignement.
procedure TForm1.GetMinMaxInfo(var Msg: TWMGETMINMAXINFO) ; begin with Msg.MinMaxInfo^ do begin ptMinTrackSize.X := 0; // min. Width ptMinTrackSize.Y := 0; // min. Height end; end;
Delphi tips navigator:
» How to Capture the Screen Shot of the Active Window
« How to Browse Delphi's VCL Source Code