B
borlandor
Unregistered / Unconfirmed
GUEST, unregistred user!
我想定义一个类类型(类似 TClass),但这个类是在程序中动态生成的。
比如下面一个函数:
function CreateRectangle(Name:String; TopLeft,BottomRightTypeInfo):TClass;
{
// ????
}
怎么实现?我有如下应用:
MyClass: TClass;
MyRect: TObject;
MyClass := CreateRectangle("TRect",TypeInfo(TPoint),TypeInfo(TPoint));
MyRect := MyClass.Create;
MyRect.TopLeft := Point(10,10);
MyRect.BottomRight := Point(100,100);
。。。。。。
比如下面一个函数:
function CreateRectangle(Name:String; TopLeft,BottomRightTypeInfo):TClass;
{
// ????
}
怎么实现?我有如下应用:
MyClass: TClass;
MyRect: TObject;
MyClass := CreateRectangle("TRect",TypeInfo(TPoint),TypeInfo(TPoint));
MyRect := MyClass.Create;
MyRect.TopLeft := Point(10,10);
MyRect.BottomRight := Point(100,100);
。。。。。。