Z
zcs16888
Unregistered / Unconfirmed
GUEST, unregistred user!
现在有几个窗体,Mainform,form1,form2等,现在已经知道在Mainform中有一个变量str:string 值为str: = 'form1'(str中的内容是可变的),那么我如何根据str直接把相应的窗体调出来(当然不能用条件判断了)?
网上资料显示:
Procedure ShowForm(str:string);
begin
var
vComponent: TComponent;
begin
vComponent := Application.FindComponent(str);
if Assigned(vComponent) then TForm(vComponent).Show;
end;
end;
能有人回答
if Assigned(vComponent) then
TForm(vComponent).Show;
else
怎样创建窗体?
网上资料显示:
Procedure ShowForm(str:string);
begin
var
vComponent: TComponent;
begin
vComponent := Application.FindComponent(str);
if Assigned(vComponent) then TForm(vComponent).Show;
end;
end;
能有人回答
if Assigned(vComponent) then
TForm(vComponent).Show;
else
怎样创建窗体?