工程中的所有FORM,不管是一运行就创建的还是调用的时候动态创建的,只要是设计时建立的FORM全部列出,最好体现层次关系,怎么循环得到啊?

解决方案 »

  1.   

    var i:integer;
    begin
      for i:=0 to application.ComponentCount-1 do
        if (application.Components[i] is Tform) then
          showmessage(Tform(application.Components[i]).Caption);
      

  2.   

    for i:=0 to ComponentCount-1 do
    begin
      if Components[i] is TForm then
        ...
    end;不知道可以不?我这里没有delphi
      

  3.   

    var
    i:integer;
    begin
    for i:=0 to Screen.FormCount-1 do
    begin
      ShowMessage(Screen.Forms[i].Caption);
    end;
      

  4.   

    to : jinjazz(近身剪(N-P攻略)) 
     procedure TForm1.Button2Click(Sender: TObject);
    begin
    Form2:=TForm2.Create(nil);
    form2.Show;
    end;
    这种情况你的代码就找不到form2了只要窗体不释放, gemouzhi(gemouzhi) 的代码可以找到form2
      

  5.   

    application.Components[i] is Tform
      

  6.   

    〉〉这种情况你的代码就找不到form2了的确,只能找到这样创建的
    Form2:=TForm2.Create(application);还是screen的好