haorui658 发表于 2010-11-5 18:23:06

不用显隐法如何在GUIOnevent模式下创建子窗口?

如题, 点击一个主窗口button后创建子窗口, 点击子窗口button再彻底注销子窗口.搜了很多,但是没有找到,特求详细代码

xianhou 发表于 2010-11-5 20:05:45

guicreate
guictrlcreatelable
guisetstate
guidelete

haorui658 发表于 2010-11-6 12:36:05

可以创建, 但是删除的时候出了麻烦, 有可以借鉴的代码吗?

xianhou 发表于 2010-11-6 13:22:46

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 379, 246, 192, 114)
$Button1 = GUICtrlCreateButton("Button1", 80, 72, 193, 65)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Form2 = 0
$delete_form2 = 0
While 1
        Sleep(1000)
        If $delete_form2 = 1 Then
        GUIDelete($Form2)
        $delete_form2 = 0
        EndIf
WEnd

Func Button1Click()
$Form2 = GUICreate("Form2", 379, 246, 292, 214)
$Button2 = GUICtrlCreateButton("Button2", 80, 72, 193, 65)
GUICtrlSetOnEvent(-1, "Button2click")
GUISetState(@SW_SHOW)
EndFunc

Func Button2Click()
$delete_form2 = 1
EndFunc

haorui658 发表于 2010-11-13 22:28:04

本帖最后由 haorui658 于 2010-11-13 22:31 编辑

谢谢楼上各位解答,但是我创建是没有问题的,相应子窗口的事件有问题, 如关闭子窗口等
页: [1]
查看完整版本: 不用显隐法如何在GUIOnevent模式下创建子窗口?