有两个FORM(FORM1 FORM2)
将FORM1的formstyle设置为fsMDIForm   
将FORM2的formstyle设置为fsMDIChild
运行。正常
但是我再把两个FORM的formstyle改回fsNormal却还是两个窗口一起跳出来,只是不再是MDI模式。我希望恢复正常模式,请问该怎么办

解决方案 »

  1.   

    工程->选项  把Form2从自动建立列表中去除
    或直接改DPR文件,把
      Application.CreateForm(TForm2, Form2);
    删除
      

  2.   

    菜单project--options把form2拖到available forms中
    然后在form1的
    implementation
    uses unit2;
    {$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    begin
      with form2.Create(nil) do
      begin
        show;
      end;
    end;end.
      

  3.   

    这些方法我试过,可惜并不解决问题,因为我的FORM2上有些代码用这种处理方法处理就会出错,但是原来是没有错的,没有别的本质的解决方法吗?我不知道为什么会出现这种情况
      

  4.   

    procedure TCustomForm.SetFormStyle(Value: TFormStyle);
    var
      OldStyle: TFormStyle;
    begin
      if FFormStyle <> Value then
      begin
        if (Value = fsMDIChild) and (Position = poDesigned) then
          Position := poDefault;
        if not (csDesigning in ComponentState) then DestroyHandle;
        OldStyle := FFormStyle;
        FFormStyle := Value;
        if ((Value = fsMDIForm) or (OldStyle = fsMDIForm)) and not Ctl3d then
          Color := NormalColor;
        if not (csDesigning in ComponentState) then UpdateControlState;
        if Value = fsMDIChild then Visible := True;////
      end;
    end;
    注意这一行,当你设置了FSMDICHILD后,VISBLE已经是TRUE了,而你改变回来了以后;VISBLE仍然执行;为TRUE;这就是原因;
      

  5.   

    outer2000(天外流星)的说法是对的,除非你对delphi源码进行修改