找回密码
 加入
搜索
查看: 2544|回复: 4

[GUI管理] 不用显隐法如何在GUIOnevent模式下创建子窗口?

[复制链接]
发表于 2010-11-5 18:23:06 | 显示全部楼层 |阅读模式
如题, 点击一个主窗口button后创建子窗口, 点击子窗口button再彻底注销子窗口.搜了很多,但是没有找到,特求详细代码
发表于 2010-11-5 20:05:45 | 显示全部楼层
guicreate
guictrlcreatelable
guisetstate
guidelete
 楼主| 发表于 2010-11-6 12:36:05 | 显示全部楼层
可以创建, 但是删除的时候出了麻烦, 有可以借鉴的代码吗?
发表于 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
 楼主| 发表于 2010-11-13 22:28:04 | 显示全部楼层
本帖最后由 haorui658 于 2010-11-13 22:31 编辑

谢谢楼上各位解答,但是我创建是没有问题的,相应子窗口的事件有问题, 如关闭子窗口等
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-13 22:56 , Processed in 0.075863 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表