做一个全局变量在form1和form2之间传递一下
如: form1中有一个tt: booleanbutton1的click里面置为truebutton2中判断一下

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
      tt: Boolean;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
      tt:=False;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      tt:=True;
    end;end.unit Unit2;interfaceuses
      Windows, Messages, SysUtils, 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;implementation
    uses unit1;
    {$R *.DFM}procedure TForm2.Button1Click(Sender: TObject);
    begin
      if tt then
      begin
        //显示FORM3窗体
      end
      else
      begin
        //退出此系统
      end
    end;end.