How to set width and height of a form in delphi

How to set width and height of a form in Delphi 7? The form contains various types of controls. I need to set the size of the main shape to 127x263. It should change programmatically by pressing a button.

+5
source share
1 answer

Same:

MainForm.Width := 127;
MainForm.Height := 263;

Or maybe you want to customize the client area to these sizes:

MainForm.ClientWidth := 127;
MainForm.ClientHeight := 263;

Of course, you most often set these properties in the object inspector during development, and then write to the form's .dfm file.

If you want this change to occur on the button, click add a handler to click the button, which looks like this:

procedure TMainForm.Button1Click(Sender: TObject);
begin
  Width := 127;
  Height := 263;
end;

MainForm, TMainForm, Self .

(. ) SetBounds, :

SetBounds(Left, Top, 127, 263);

, Scaled = True, . , , , .

+13

All Articles