procedure PnlShowForm(ShowForm:TFormClass);
procedure PnlShowClear;
procedure TFrmMain.PnlShowForm(ShowForm:TFormClass);
var
MyForm:TForm;
begin
PnlShowClear;
MyForm:=ShowForm.Create(Application);
MyForm.Parent:=PnlShow;
MyForm.Left:=0;
MyForm.Top:=0;
MyForm.Show;
end;
procedure TFrmMain.PnlShowClear;
var
i:Integer;
begin
for i:=0 to PnlShow.ControlCount - 1 do
begin
if PnlShow.Controls[i] is TForm then
PnlShow.Controls[i].Free;
end;
end;
备注:子窗口formstyle属性要设为fsNormal,设为其他值子窗口显示在父窗口中,而不在panel内,和panel分离.