可以在运行时创建表单吗?
VFP,可以在一个项目里只有一个PRG文件,并且在运行这个PRG时创建表单和控件吗?比如创建一个fm1表单,标题是"创建表单测试"
表单上再创建一个按钮,click代码是thisform.release
可以吗?
SET TALK OFF CREATE FORM fm1 NOWAIT SAVE DO FORM fm1 fm1.caption="求一元二次方程" fm1.addobject('cmdExit','cmdMyCmndBtn1') fm1.cmdExit.Visible=.t. READ events DEFINE CLASS cmdMyCmndBtn1 as CommandButton caption="退出" PROCEDURE click thisform.release ENDDEFINE
** Test.prg of = CREATEOBJECT("fm1") of.Show READ EVENTS DEFINE CLASS fm1 as Form WindowType = 1 ShowWindow = 2 Desktop = .T. AutoCenter = .T. Caption="求一元二次方程" ADD OBJECT cmdExit as cmdMyCmndBtn1 WITH top=10,left=10 PROCEDURE UnLoad CLEAR EVENTS ENDPROC ENDDEFINE DEFINE CLASS cmdMyCmndBtn1 as CommandButton Visible = .T. caption = "退出" height = 25 width = 50 PROCEDURE Click thisform.Release ENDPROC ENDDEFINE