如题

解决方案 »

  1.   

    try
      Form2.showModal;
    except
      showmessage('打开失败!');
    end
      

  2.   

    CSDN里真的没兄弟会的帮帮忙吗?
      

  3.   

    for i:=0 to Screen.FormCount-1 do
    begin
      if screen.form[i].classtype=Tform2 then showmessage('已经存在form2.');
    end;
      

  4.   

    if not Assigned(Form2) then
         Form2:=TForm2.Create(Application);
      Form2.Show;
      

  5.   

    要是ShowModal的话就没必要再去判断了。
      

  6.   

    同意楼上  if Form2 = nil then
        Form2 := TForm2.Create(Application);
      Form2.Show;
      

  7.   

    showmodal是程序暂停执行,所以呢,在关掉这个窗口前,你是不可能再打开的
      

  8.   

    if form2<>nil then
       Form2:=Tform2.create(application);
    Form2.ShowModal;From2的OnClose事件中加上如下代码
    Action:=caFree;
    Form2:=nil;
      

  9.   

    for i:=0 to Screen.FormCount-1 do
    begin
      if screen.form[i].classtype=Tform2 then showmessage('已经存在form2.');
    end;
    这个方法不错!!
      

  10.   

    var
      i: Integer;
      SubForm: TSubForm;
    begin
      for i:=0 to Screen.FormCount-1 do
        if Screen.Forms[i].classtype=TSubForm then break;
      if i = Screen.FormCount then
        SubForm := TSubForm.Create(Application);
      SubForm.Show;
    end;这个肯定行