。谢了

解决方案 »

  1.   

    就是:onFormDestroy()/onFormCreate()
      

  2.   

    兄弟我初次使用Delphi,请明士onformcreate/onFormDestroy自身并没有带参数呀,我的意思是说,我在一个窗口中打开一个新窗口,并传递参数给它,或者关闭一个窗口,返回参数给打开他的窗口另,请问,有什么比较好的Delphi的入门的书。谢了。。
      

  3.   

    像这样:
    try
      form2:=Tform2.create(nil);
      form2.a:=1;//a 是form2的变量
      form2.showmodal;
      c:=form2.b;//c是本单元变量,b是form2的变量
    finally
      form2.free;
    end;
      

  4.   

    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm2 = class(TForm)
      private
        { Private declarations }
      public
        { Public declarations }
        function ShowModal(var param1:string): Integer;overload;
      end;var
      Form2: TForm2;implementation{$R *.dfm}function TForm2.ShowModal(var param1:string): Integer;
    begin
      result := inherited ShowModal();
      param1 := 'test';
    end;
    调用:
    procedure TForm1.Button1Click(Sender: TObject);
    var
      s : string;
    begin
      s := '';
      Form2 := TForm2.Create(Application);
      try
        Form2.ShowModal(s);
      finally
        Form2.Free;
      end;  ShowMessage(s);end;
      

  5.   

    delphi编程与pb编程不同,你可以定义一个公共变量单元(unit,记住是不带form的unit,例如unit_public)来定义所有的公共变量和公共结构,注意必须在public关键字后声明,然后在需要使用这些变量和结构的单元内加入应用:uses unit_public,这样载需要存储的时候赋值,需要引用的时候取值就可以了,这其实是对类属性的调用,可以视之为“公共变量”。