请问:
1: TFormClass = class of TForm;是不是等同于  TFormClass = class(TForm);
    TFormClass和TForm有什么不同啊;
2:string和stringlist有什么区别

解决方案 »

  1.   

    不一样
    1:TFormClass = class of TForm;//-->TFormClass == TForm
      TFormClass = class(TForm);  //-->TFormClass 继承至 TForm
    2:string是一般在字符串;//如str := 'abc' ;
      stringlist是字符串列表,可以像数组一样访问的,
    使用时要创建的,最后要释放
    strList := TSTringList.Create;
    strList.Add('abc');
    strList.Add('123');
    //...
    strList.Free;
      

  2.   

    既然Tformclasss==Tform,为什么还要Tformclass?我真的不懂啊,不要骂人啊
      

  3.   

    2.StringList的每一项是String,其为'字符串列表';str := StringList.Items(i)
      

  4.   

    由TFormClass = class of TForm声明的TFormClass是元类类型,它可以用来声明TForm类,而TFormClass = class(TForm)中的TFormClass是TForm的派生类,可以用来声明对象,
    string是保存字符串用的,而stringlist是TStrings的派生类TStringList声明的对象,是字符串数组,它能保存一系列的字符串,使用时要自己创建,自己销毁,String则不用!
      

  5.   

    用TFormClass = class of TForm声明的TFormClass的元类类型一般用在函数或过程的参数中,用来传递TForm类型的形参!
      

  6.   

    贴一些给你:定义一个Tcontrolclass:
    type TControlClass = class of TControl;
    编写一个创建TControl的函数
    function CreateControl(ControlClass: TControlClass;
      const ControlName: string; X, Y, W, H: Integer): TControl;
    begin
      Result := ControlClass.Create(MainForm);
      with Result do
      begin
        Parent := MainForm;
        Name := ControlName;
        SetBounds(X, Y, W, H);
        Visible := True;
      end;
    end;
    调用:
    CreateControl(TEdit, 'Edit1', 10, 10, 100, 20);
    这里,Tedit是TControl的子类就可以正常运行。