哈哈,这回是子窗体一闪而过了
直接上代码吧,迷糊了https://bbs.bccn.net/thread-460213-1-1.html
17楼的代码基础上,加了点东西
程序代码:
CLEAR ALL CLOSE PROCEDURES SET PATH TO "..\MyTools" SET PROCEDURE TO "MyForm", "MyLogin","otherForm" PUBLIC gcUserName Login("gcUserName") IF !EMPTY(gcUserName) Main() ENDIF CLOSE PROCEDURES CLEAR ALL RETURN PROCEDURE Main() LOCAL loMainForm loMainForm = CREATEOBJECT("C_MainForm") WITH loMainForm .Caption = "主窗体" .Width = 600 .Height = 400 .AutoCenter = .T. .Show ENDWITH READ EVENTS ENDPROC DEFINE CLASS C_MainForm AS MyForm ShowWindow = 2 ADD OBJECT Label1 AS Label WITH Caption = "欢迎您!" + gcUserName, FontSize = 36, AutoSize = .T. ADD OBJECT runOtherForm as commandButton WITH caption="运行另一表单",top=5,autoSize=.t. PROCEDURE Arrange WITH This.Label1 .Top = (This.Height - .Height) / 2 .Left = (This.Width - .Width) / 2 ENDWITH ENDPROC PROCEDURE runOtherForm.click runOtherForm1() ENDPROC ENDDEFINE
程序代码:
&&otherForm.prg PROCEDURE runOtherForm1 LOCAL otherForm1 otherForm1=CREATEOBJECT("m1Form") otherForm1.show READ EVENTS ENDPROC DEFINE CLASS m1Form as myForm &&showWindow=2 caption="功能模块1窗口" width=500 height=300 autoCenter=.t. &&windowType=1 ADD OBJECT button1 as commandButton WITH caption="返回主表单",top=5,autoSize=.t. PROCEDURE button1.click RELEASE thisform ENDPROC PROCEDURE Destroy MESSAGEBOX("模块1表单销毁了",64,"123") ENDPROC ENDDEFINE
各窗体之间的工作交接流程,还是搞不明白。。。