function OpenwithParm(frm:TForm;param:String);
begin
 frm:=TForm.Create();
 frm.Param:=Param;
 try
  frm.Showmodal;
 finally
  frm.free;
 end;
end;
上面的代码中,frm是事先设计好的窗体类型,frm.param是在frm窗体类型中定义的公有变量。当然可以设以为多个变量。

解决方案 »

  1.   

    如果我要在FORM的CREATE事件中使用这些参数,那么你们的办法不是没有用吗!
      

  2.   

    你可以重载constructor
    在private中声明
    constructor openwithparam(param:tparam,owner:tobject);
    begin
    inherite create(owner);//继承原始创建方法
    你自己的代码
    可以对param进行处理
    end;
    创建该窗口时用openwithparam代替create
    就行了
      

  3.   

    创建一个unit,声明一些要用的变量,然后在每个unit中使用它,把声明的变量作为全局变量就可以了。