var
TC:TComponentClass;
V :TComponent;
begin
TC=TComponentClass(FindClass(yourClassName));//yourClassName就是你的EIDT类名
if TC<>nil then
V:=TC.Create(AOwner);
end;
procedure GenerateComponent(AParent:TComponent;
AClass:String; //在这里代入你的Edit.Text
X,y:Integer);
var
MyClass:TComponentClass;
MyObj:TComponent;
begin
MyClass:=TComponentClass(GetClass(AClass));
if MyClass=nil then beep;
else
begin
MyObj:=MyClass.Create(AParent);
if MyObj.InheritsFrom(TControl) then
begin
TControl(MyObj).Left:=X;
TControl(MyObj).top:=Y;
TControl(MyObj).Parent:=AParent;
end;
end;
end;
procedure GenerateComponent(AParent:TComponent;
AClass:String; //在这里代入你的Edit.Text
X,y:Integer);
var
MyClass:TComponentClass;
MyObj:TComponent;
begin
MyClass:=TComponentClass(GetClass(AClass));
if MyClass=nil then beep;
else
begin
MyObj:=MyClass.Create(AParent);
if MyObj.InheritsFrom(TControl) then
begin
TControl(MyObj).Left:=X;
TControl(MyObj).top:=Y;
TControl(MyObj).Parent:=AParent;
end;
end;
end;
楼上的似乎可行,一会儿试试
但如果再入一层
var
TC:TComponentClass;
V :TComponent;
begin
TC=TComponentClass(FindClass(yourClassName));//yourClassName的EIDT类名
if TC<>nil then
V:=TC.Create(AOwner);
end;