从form1 中怎么判断form2已经被打开了还是已经关闭了?

解决方案 »

  1.   

    不知道用这个行不行:
       if form2=nil then
      

  2.   

    Form1放一個變量,Form2打开或关闭時設置變量值.
      

  3.   

    if not Assigned(Form2) then
    begin
       if IsWindowVisible(Form2.Handle) then
          存在...
       else 
          不存在;
    end
    else
         不存在;
      

  4.   

    if not Assigned(Form2) then
    begin
       if Form2.Showing then
          存在...
       else 
          不存在;
    end
    else
         不存在;
      

  5.   

    好像只能自己用变量来判断,在C++里也是这样。没听说可以用什么form自带的一些属性或函数可以判断。
      

  6.   

    首先在Form1的单元引用Form2所在单元,然后在你需要实现功能的地方放如下代码:if Assigned(Form2) then
      case Ord(Form2.Visible) of 
        0: ShowMessage('创建后显示');
        1: ShowMessage('创建后隐藏');
      end
    else
      ShowMessage('未创建');