找回密码
 加入
搜索
查看: 5951|回复: 12

[GUI管理] [已解决]如何创建一个模态窗体 GuiCreate

  [复制链接]
发表于 2011-5-12 02:16:54 | 显示全部楼层 |阅读模式
本帖最后由 zhaicheng 于 2011-5-18 22:15 编辑

如何创建一个模态窗体 GuiCreate?

像对话框一样的。。。
发表于 2011-5-12 04:36:00 | 显示全部楼层
打开SciTE编辑器!在工具那里有个  窗口设计(Koda) 点后进去设计就行!!
如果要自己设计皮肤!就看教程创建皮肤的相关教程吧。要调用皮肤就找到SKinCrafterdDll.dll动态支持文件
和.SKF后缀的文件!!论坛里多!!!
 楼主| 发表于 2011-5-12 09:59:46 | 显示全部楼层
打开SciTE编辑器!在工具那里有个  窗口设计(Koda) 点后进去设计就行!!
如果要自己设计皮肤!就看教程 ...
qiziyun7410 发表于 2011-5-12 04:36



    我说的模态窗口指的是 总在前面,强制焦点,不关闭无法继续那种。
 楼主| 发表于 2011-5-12 10:13:52 | 显示全部楼层
即 Modal window
 楼主| 发表于 2011-5-12 10:13:54 | 显示全部楼层
即 Modal window
 楼主| 发表于 2011-5-12 10:17:54 | 显示全部楼层
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[1] = $popup And $msg[0] = $GUI_EVENT_CLOSE ; Modal close
            GUISetState(@SW_HIDE, $popup)
            GUISetState(@SW_ENABLE, $main)
            WinActivate($main)
        Case $msg[1] = $main And $msg[0] = $GUI_EVENT_CLOSE ; Main close
            ExitLoop
        Case $msg[1] = $main And $msg[0] = $Button_1 ; Input click, Modal open
            GUISetState(@SW_DISABLE, $main)
            GUISetState(@SW_SHOW, $popup)
    EndSelect
WEnd
Exit
发表于 2011-5-12 10:35:15 | 显示全部楼层
是这个意思?
#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[1] = $popup And $msg[0] = $GUI_EVENT_CLOSE ; Modal close
            GUISetState(@SW_HIDE, $popup)
            GUISetState(@SW_SHOW, $main)
            WinActivate($main)
        Case $msg[1] = $main And $msg[0] = $GUI_EVENT_CLOSE ; Main close
            ExitLoop
        Case $msg[1] = $main And $msg[0] = $Button_1 ; Input click, Modal open
            GUISetState(@SW_HIDE, $main)
            GUISetState(@SW_SHOW, $popup)
    EndSelect
WEnd
Exit
发表于 2011-5-12 12:16:38 | 显示全部楼层
回复 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[1] = $popup And $msg[0] = $GUI_EVENT_CLOSE ; 子窗口关闭,隐藏子窗口,启用主窗口并激活
            GUISetState(@SW_HIDE, $popup)
                        WinSetState($main,"",@SW_ENABLE)
            WinActivate($main)
        Case $msg[1] = $main And $msg[0] = $GUI_EVENT_CLOSE ; 主窗口关闭,程序退出
                        If WinGetState($popup)=5 Then
                                ExitLoop
                        EndIf
        Case $msg[1] = $main And $msg[0] = $Button_1 ; 点击按钮,打开子窗口。
            GUISetState(@SW_SHOW, $popup)
        EndSelect
        If WinGetState($popup)=7 Then  ;检测子窗口存在且处于非激活状态,激活。 禁用主窗口。
                WinSetState($main,"",@SW_DISABLE)
                WinActivate($popup)
        EndIf
WEnd
发表于 2011-5-12 12:23:06 | 显示全部楼层
我是来围观论坛元老的
发表于 2011-5-14 00:03:18 | 显示全部楼层
回复 8# lanfengc


    元老就是元老,代码很简洁~~只是有时候我们菜鸟理解起来有些困难`~
发表于 2011-5-14 00:26:20 | 显示全部楼层
回复  lanfengc


    元老就是元老,代码很简洁~~只是有时候我们菜鸟理解起来有些困难`~
annybaby 发表于 2011-5-14 00:03



     只是改了下3mile 的代码而已。
发表于 2011-5-14 07:23:57 | 显示全部楼层
本帖最后由 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
不知道要求是什么
发表于 2014-3-17 13:26:59 | 显示全部楼层
回复 8# lanfengc


    正解!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 20:18 , Processed in 0.080157 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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