Delphi User's Guide > Creating a Simple Word Processor
Two steps are involved in making the controls resize properly when the main window is resized.
Set the Align property to alTop for the Button Bar, the Ruler and the Text Control. Set it to alBottom for the Status Bar. This will adjust everything except the height of the Text Control.
Change to the events listing in the property window and double-click the OnResize event. The code window should show an empty procedure for the Resize event:
procedure TForm1.FormResize(Sender: TObject); begin end;
Extend it as follows:
procedure TForm1.FormResize(Sender: TObject); begin TXTextControl1.Height := ClientHeight - TXRuler1.Height - TXStatusBar1.Height - TXButtonBar1.Height; TXTextControl1.Width := ClientWidth; TXRuler1.Width := ClientWidth; end;
This line of code will cause the Text Control's height and width to be adjusted every time the size of the form is altered.