implementation
var OldWi, OldHi : Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
oldWi := Form1.Width;
OldHi := Form1.Height;
end;
procedure TForm1.FormResize(Sender: TObject);
var fx, fy : single;
i : integer;
begin
Fx := Form1.width /oldwi;
Fy := Form1.Height / oldhi;
oldwi := Form1.width;
oldhi := Form1.Height;
DisableAlign;
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TWinControl then
begin
TwinControl(Components[i]).SetBounds(round (TwinControl(Components[i]).left*Fx),
round (TwinControl(Components[i]).Top*Fy),
round (TwinControl(Components[i]).Width*Fx),
round (TwinControl(Components[i]).Height*Fy) );
TwinControl(Components[i]).Font.Height:=
round(TwinControl(Components[i]).Font.Height*Fy);
end;
if Components[i] is TGraphicControl then
begin
TGraphicControl(Components[i]).SetBounds(round(TGraphicControl(Components[i]).left*Fx),
round(TGraphicControl(Components[i]).Top*Fy),
round(TGraphicControl(Components[i]).Width*Fx),
round(TGraphicControl(Components[i]).Height*Fy) );
TGraphicControl(Components[i]).Font.Height :=
round(TGraphicControl(Components[i]).Font.Height*Fy);
end;
end; // i
OldWi := Form1.Width;
OldHi := Form1.Height;
EnableAlign;
end;