在form1中创建form2,然后from2.showmodal就可以了

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,  Dialogs,StdCtrls,Unit2;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    {$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    begin
      Form2.ShowModal;
    end;end.
      

  2.   

    还有一个问题,procedure TForm1.FormCreate(Sender: TObject);
    begin
     from2.show
    end;
    为什么会出错呢
    另外给分
      

  3.   

    from2.show;
    from1.enabled:=false;
      

  4.   

    "还有一个问题,procedure TForm1.FormCreate(Sender: TObject);
    begin
     from2.show
    end;
    为什么会出错呢
    另外给分"确实是这样,不能这样写,但是我还没想到该怎么做,关注
      

  5.   

    from2是一个变量,应该是一个TForm2(你自己定义的)类型的变量
    这种变量不同于一般的变量可以随便拿过来用的,必须先给这种变量指定一定的内存,这种指定内存的功能就由TForm2.create来进行
      

  6.   

    if form2=nil then form2:=TFrom2.create(self);
    form2.showmodal;
      

  7.   

    如果form2属于unit2则应在一开始加入unit2声明,
    在程序中,
    procedure TForm1.FormCreate(Sender: TObject);
    begin
     unit2.from2.show
    end;