将窗体的类名作为参数传入一个创建窗体的函数,
实现动态创建窗体,请指点。

解决方案 »

  1.   

    procedure showform(formclass: tformclass;Fm_caption:string);//打开窗口设置标题过程
    begin
    With FormClass.Create(application) do
      try
        if Fm_caption<>'' then
        caption:=Fm_caption;
        ShowModal;
      finally
        Free;
      end;
    end;
      

  2.   

    procedure OpenForm(FormClass: TFormClass; var fm; AOwner: TComponent);//创建子窗体(不重复创建)抄的
    var
      i: integer;
      Child: TForm;
    begin
      for i := 0 to Screen.FormCount - 1 do
        if Screen.Forms[i].ClassType = FormClass then
        begin
          Child := Screen.Forms[i];
          if Child.WindowState = wsMinimized then
            ShowWindow(Child.handle, SW_SHOWNORMAL)
          else
            ShowWindow(Child.handle, SW_SHOWNA);
          if (not Child.Visible) then Child.Visible := True;
          Child.BringToFront;
          Child.Setfocus;
          TForm(fm) := Child;
          exit;
        end;
      Child := TForm(FormClass.NewInstance);
      TForm(fm) := Child;
      Child.Create(AOwner);
    end;
      

  3.   


    借楼主宝地一用
    鉴别CSDN星星的含金量http://expert.csdn.net/Expert/topic/2147/2147062.xml?temp=.9299433
      

  4.   

    Form1:=applicaton.CreateForm(Tfrom1,from1);
      

  5.   

    我用的
    procedure TMainForm.ShowForm(FormClass: TFormClass);
    begin
      with FormClass.Create(self) do
      Try
      ShowModal;
      Finally
      Free;
      end;
    end;
      

  6.   

    http://www.delphibbs.com/keylife/iblog_show.asp?xid=343
    http://www.delphibbs.com/delphibbs/dispq.asp?lid=2106012