程序有两个窗体。
在frm1中user frm2 
这样可以用
frm1.hide ;
frm2,show ;
从frm1切换到frm2但是
如何从frm2切换回frm1?请大虾,小虾赐教!!

解决方案 »

  1.   

    在frm2中user frm1 
    这样可以用
    frm2.hide ;
    frm1.show ;
      

  2.   

    再写一个重新调回原窗体
    frm2.hide;
    frm1.show;
      

  3.   

    在Form1中如下写:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
    self.Hide;
    Form2.Show;
    end;end.
    在Form2中如下写:
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form2: TForm2;implementationuses Unit1;{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
    begin
    self.Hide;
    Form1.Show;
    end;end.
      

  4.   

    不用这么麻烦嘛
    在你需要的地方加上
    frm1.visable:=not frm1.visable;就好了
      

  5.   

    哦,差点忘了,在From2时,一定要Use unit1