Mega Code Archive

 
Categories / Delphi / Forms
 

MinMax track size and position for form

Title: Min/Max track size and position for form Question: How to control your form size, track size , maximiazed position Answer: In Delphi 4 , we have a new property for the form called "Constraints" to set the Max and Min size for the form, but is this enough for you? if not then try this code: // declare this in the private section for your form: procedure WMGetMinMaxInfo( var Message : TWMGetMinMaxInfo ); message WM_GetMinMaxInfo; // Write this procedure: procedure TForm1.WMGetMinMaxInfo( var Message : TWMGetMinMaxInfo ); begin // Set the Max Size which the user can resize the form with Message.MinmaxInfo.ptMaxTrackSize.x := 500; Message.MinmaxInfo.ptMaxTrackSize.y := 500; // Set the Min Size which the user can resize the form with Message.MinmaxInfo.ptMinTrackSize.x := 300; Message.MinmaxInfo.ptMinTrackSize.y := 300; // Set the Max Size of window when it is Maximized (New!) Message.MinmaxInfo.ptMaxSize.x := 500; Message.MinmaxInfo.ptMaxSize.y := 500; // Set the X and Y position for the form when it is Maximized (New!) Message.MinmaxInfo.ptMaxPosition.x := 20; Message.MinmaxInfo.ptMaxPosition.y := 20; // NOTE: This code was tested on deplhi 4, Windows NT workstation 4 end;