IF NOT 存在(FROM) THEN 
BEGIN
  CREATE
END
ELSE
SHOW;要实现上面的怎么写啊?

解决方案 »

  1.   

    1、 if not Assigned (form1) then
          form1:=Tform.create(self);
        form1.show;     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;
      

  2.   

    if  not Assigned(form2) then
      application.CreateForm(TForm2, Form2);
    form2.show;
      

  3.   

    THANKS;
    我们一般在什么时候设置MDICHILD的一些基本属性
    如TOP,WIDTH,LEFT,HEIGHT等
    在什么事件设置呢?