procedure TForm1.CreatForm(const FormClassName, FormName: string);
beginif FindComponent(FormName)=nil then
if GetClass(FormClassName)<>nil then
with TForm(TComponentClass(FindClass(FormClassName)).Create(Application)) do
begin
Name:=FormName;
Show;
end;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
CreatForm('TForm2','Form2');
end;
要在form2中进行对类注册下
initialization
RegisterClass(TForm2);
finalization
UnRegisterClass(TForm2);