事件模式、可返回主窗口Opt('GUIOnEventMode', 1)
$Form1 = GUICreate('Form1 <-> Form2 - Afan')
GUISetOnEvent(-3, '_exit')
$Button1 = GUICtrlCreateButton('切换至Form2', 50, 290, 100, 20)
GUICtrlSetOnEvent(-1, 'Form1')
$Form2 = GUICreate('Form2', 300, 200)
GUISetOnEvent(-3, 'Form2')
$Button2 = GUICtrlCreateButton('返回Form1', 180, 150, 100, 20)
GUICtrlSetOnEvent(-1, 'Form2')
$Button3 = GUICtrlCreateButton('退出程序', 50, 150, 100, 20)
GUICtrlSetOnEvent(-1, 'Form2')
GUISetState(@SW_SHOW, $Form1)
While 1
Sleep(1000)
WEnd
Func Form1()
GUISetState(@SW_HIDE, $Form1)
GUISwitch($Form2)
GUISetState()
EndFunc ;==>Form1
Func Form2()
Switch @GUI_CtrlId
Case $Button2, -3
GUISetState(@SW_HIDE, $Form2)
GUISwitch($Form1)
GUISetState()
Case $Button3
Exit
EndSwitch
EndFunc ;==>Form2
Func _exit()
Exit
EndFunc ;==>_exit
|