wyx5 发表于 2009-2-10 09:46:41

对于窗体的操作(很菜的问题)

请问我有一个FORM1的窗体,上边上面有一个:”按扭“
单击这个按扭的时候显示一个新的窗体FORM2,然后FORM1禁用,在FORM2上编辑一些命令,完成后关闭FORM2(按右上角的小叉子),然后FORM1起用。请问该如何实现???
我自己做了一个,当关闭FORM2窗体的时候,FORM1也关闭了
请问是什么原因???

cnsnc 发表于 2009-2-10 09:57:09

用GUIDELETE关闭FORM2

wyx5 发表于 2009-2-10 10:38:57

原帖由 cnsnc 于 2009-2-10 09:57 发表 http://www.autoitx.com/images/common/back.gif
用GUIDELETE关闭FORM2

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 294, 213, 192, 124)
$Button1 = GUICtrlCreateButton("更多...", 176, 136, 97, 57, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $Msg1 = GUIGetMsg()
        Switch $Msg1
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                                                $Form2 = GUICreate("Form2", 219, 213, 302, 218)
                        $Button1 = GUICtrlCreateButton("设置1", 72, 48, 75, 25, 0)
                        $Button2 = GUICtrlCreateButton("设置2", 72, 88, 75, 25, 0)
                        $Button3 = GUICtrlCreateButton("设置3", 72, 128, 75, 25, 0)
                        GUISetState(@SW_SHOW)
                                While 1
                                        $Msg2 = GUIGetMsg()
                                        Select
                                        Case $Msg2 =$GUI_EVENT_CLOSE
                                                Exit
                                        Case $Msg2 =$Button1
                                                ;
                                        Case $Msg2 =$Button2
                                                ;
                                        Case $Msg2 =$Button3
                        ;
        EndSelect
        GUISetState(@SW_ENABLE,$form1)
WEnd
        EndSwitch
WEnd
这是代码,帮忙看看吧

顽固不化 发表于 2009-2-10 12:49:11

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 294, 213, 192, 124)
$Button1_1 = GUICtrlCreateButton("更多...", 176, 136, 97, 57, 0)

$Form2 = GUICreate("Form2", 219, 213, 302, 218)
$Button1_2 = GUICtrlCreateButton("设置1", 72, 48, 75, 25, 0)
$Button2_2 = GUICtrlCreateButton("设置2", 72, 88, 75, 25, 0)
$Button3_2 = GUICtrlCreateButton("设置3", 72, 128, 75, 25, 0)

GUISetState(@SW_SHOW,$Form1)
GUISetState(@SW_HIDE,$Form2)

While 1
        $Msg1 = GUIGetMsg()
        Switch $Msg1
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1_1
                        GUISetState(@SW_DISABLE,$Form1)
                        GUISetState(@SW_SHOW,$Form2)
                        While 2
                                $Msg2 = GUIGetMsg()
                                Select
                                        Case $Msg2 = $GUI_EVENT_CLOSE
                                                GUISetState(@SW_HIDE,$Form2)
                                                GUISetState(@SW_ENABLE,$Form1)
                                                WinActivate($Form1)
                                                ExitLoop
                                        Case $Msg2 = $Button1_2
                                                ;
                                        Case $Msg2 = $Button2_2
                                                ;
                                        Case $Msg2 = $Button3_2
                                                ;
                                EndSelect
                        WEnd
        EndSwitch
WEnd
页: [1]
查看完整版本: 对于窗体的操作(很菜的问题)