写作日期:2019-10-19 作者:习践无界
(平台开发思路:一个模板根据数据库模块配置表生成无数模块。程序就只需维护这个模板就行了,省时省精力,程序稳定,模块开发快捷。)
Form或者Frame中可以将字段定义在public中,注意字段定义要放在过程前。如下图定义了一个Formid字段。定义字段后,在动态生成的Form或者Frame时就非常方便调用了。
动态生成Form或者Frame时对自定义字段进行赋值:
Frame1:= TFrame01_Frame.Create(nil);
Frame1.Parent := MyTabSheet;
Frame1.Visible := True ;
Frame1.Align:=alClient;
//给Frame1中的自定义字段赋值
Frame1.Formid:=EName;
//核心按钮,单击事件中根据Formid值,动态生成相关控件 (Formid值是数据库模块配置表中的模块名称。这样可以实现一个模板根据数据库模块配置表生成无数模块。程序就只需维护这个模板就行了,省时省精力。然后把节省的时间用在学习实践佛法上。)
Frame1.button5.Click;
Frame1.Show;