Limit the size and position of a form while redimensioning
If we put a limit to the Width or the Height of the form in the event OnResize
we will see an unpleasant flicker efect in the form.
To avoid it, enough simply with to capture the message TWMGETMINMAXINFO and to treat him with
For example, to fix the dimensions and the position of the form when it is maximzed:
First we capture the message putting this it lines in the private part of the form:
And we put the procedure that treats the message in the implementation part of the form:
This will make our form, when being maximized to be of 300x300 and be in Top 10 and Left 10
If what we look for is that the user cannot diminish the size of the form until a limit:
This will make that the form cannot be made smaller than 300x300 pixels.
If we want it is to put the limit when enlarging it... that is to say, not to allow that the
user makes the form bigger that certain limits:
This will make that the form cannot be enlarged more than 300x300 pixels
Look for in the help file of the Api (win32.hlp) the help for the message WM_GETMINMAXINFO and
you will see all the possibilities that it offers us.
Sent by: DARIO ALVAREZ ARANDA (firstname.lastname@example.org)
For Delphi4 or later:
Updated at 07/09/2000