[已解决]如何创建一个模态窗体 GuiCreate
本帖最后由 zhaicheng 于 2011-5-18 22:15 编辑如何创建一个模态窗体 GuiCreate?
像对话框一样的。。。 打开SciTE编辑器!在工具那里有个窗口设计(Koda) 点后进去设计就行!!
如果要自己设计皮肤!就看教程创建皮肤的相关教程吧。要调用皮肤就找到SKinCrafterdDll.dll动态支持文件
和.SKF后缀的文件!!论坛里多!!! 打开SciTE编辑器!在工具那里有个窗口设计(Koda) 点后进去设计就行!!
如果要自己设计皮肤!就看教程 ...
qiziyun7410 发表于 2011-5-12 04:36 http://autoitx.com/images/common/back.gif
我说的模态窗口指的是 总在前面,强制焦点,不关闭无法继续那种。 即 Modal window 即 Modal window What you are doing wrong is not providing a reproduction script. You should be punished for your insolence!!
Joking aside, here's what you wanted.. Can has treat please.
[ autoIt ] ( Expand - Popup )
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$main = GUICreate("MyGUI", 392, 322)
$Button_1 = GUICtrlCreateButton("Input", 140, 190, 70, 30)
GUISetState()
$popup = GUICreate("PopUP", 191, 185, -1, -1, -1, $WS_EX_TOPMOST)
While 1
$msg = GUIGetMsg(1)
Select
Case $msg = $popup And $msg = $GUI_EVENT_CLOSE ; Modal close
GUISetState(@SW_HIDE, $popup)
GUISetState(@SW_ENABLE, $main)
WinActivate($main)
Case $msg = $main And $msg = $GUI_EVENT_CLOSE ; Main close
ExitLoop
Case $msg = $main And $msg = $Button_1 ; Input click, Modal open
GUISetState(@SW_DISABLE, $main)
GUISetState(@SW_SHOW, $popup)
EndSelect
WEnd
Exit 是这个意思?
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$main = GUICreate("MyGUI", 392, 322)
$Button_1 = GUICtrlCreateButton("Input", 140, 190, 70, 30)
GUISetState(@SW_HIDE)
$popup = GUICreate("PopUP", 191, 185, -1, -1, -1, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg(1)
Select
Case $msg = $popup And $msg = $GUI_EVENT_CLOSE ; Modal close
GUISetState(@SW_HIDE, $popup)
GUISetState(@SW_SHOW, $main)
WinActivate($main)
Case $msg = $main And $msg = $GUI_EVENT_CLOSE ; Main close
ExitLoop
Case $msg = $main And $msg = $Button_1 ; Input click, Modal open
GUISetState(@SW_HIDE, $main)
GUISetState(@SW_SHOW, $popup)
EndSelect
WEnd
Exit 回复 7# 3mile
他不是这个意思。
是这样的。
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$main = GUICreate("MyGUI", 392, 322)
$Button_1 = GUICtrlCreateButton("Input", 140, 190, 70, 30)
$popup = GUICreate("PopUP", 191, 185, -1, -1, -1, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW,$main)
GUISetState(@SW_SHOW,$popup)
While 1
$msg = GUIGetMsg(1)
Select
Case $msg = $popup And $msg = $GUI_EVENT_CLOSE ; 子窗口关闭,隐藏子窗口,启用主窗口并激活
GUISetState(@SW_HIDE, $popup)
WinSetState($main,"",@SW_ENABLE)
WinActivate($main)
Case $msg = $main And $msg = $GUI_EVENT_CLOSE ; 主窗口关闭,程序退出
If WinGetState($popup)=5 Then
ExitLoop
EndIf
Case $msg = $main And $msg = $Button_1 ; 点击按钮,打开子窗口。
GUISetState(@SW_SHOW, $popup)
EndSelect
If WinGetState($popup)=7 Then;检测子窗口存在且处于非激活状态,激活。 禁用主窗口。
WinSetState($main,"",@SW_DISABLE)
WinActivate($popup)
EndIf
WEnd 我是来围观论坛元老的{:face (411):} 回复 8# lanfengc
元老就是元老,代码很简洁~~只是有时候我们菜鸟理解起来有些困难`~ 回复lanfengc
元老就是元老,代码很简洁~~只是有时候我们菜鸟理解起来有些困难`~
annybaby 发表于 2011-5-14 00:03 http://www.autoitx.com/images/common/back.gif
只是改了下3mile 的代码而已。 本帖最后由 netegg 于 2011-5-14 09:30 编辑
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$main = GUICreate('', 198, 198, -1, -1)
$Button1 = GUICtrlCreateButton("退出程序", 10, 160, 80, 30)
GUICtrlSetOnEvent($Button1, "Button1")
GUISetState()
$gui = GUICreate("MYFROM", 200, 200, -1, -1, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_TOPMOST))
$Button2 = GUICtrlCreateButton("退出", 10, 120, 50, 30)
GUICtrlSetOnEvent($Button2, "Button2")
GUISetState()
GUISetState(@SW_DISABLE, $main)
While 1
Sleep(1000)
WEnd
Func Button1()
Exit
EndFunc ;==>Button1
Func Button2()
GUISetState(@SW_Hide, $gui)
GUISetState(@SW_ENABLE, $main)
EndFunc ;==>Button1
不知道要求是什么 回复 8# lanfengc
正解!
页:
[1]