Topic: Resize Form
Hi everyone. Please tell me what is my mistake? There is a form frmStart it is the main one, it has a button Button1 when it is clicked, the form Form1 appears but it must be inside the form frmStart while its position must be within the size of the table on the form frmStart
procedure frmStart_OnShow (Sender: TObject; Action: string);
begin
Form1.Parent:= Form1;
Form1.Align:= alCustom;
end;
procedure frmStart_OnResize (Sender: TObject);
begin
if Form1 <> nil then
begin
Form1.Left:= frmStart.ClientWidth div 2 - Form1.Width div 2;
Form1.Top:= frmStart.ClientHeight div 2 - Form1.Height div 2;
end;
end;
procedure frmStart_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.Show;
Form1.Parent:= frmStart;
Form1.Align:= alCustom;
Form1.Position:= poMainFormCenter;
end;
procedure frmStart_OnClose (Sender: TObject; Action: string);
begin
Form1:= nil;
end;
begin
end.