四海皆狂龙 发表于 2009-8-16 06:54:08

如何实现下一步切换到另一个窗口?

象安装程序一样,按下一步就可以切换到另一个窗口,原来的窗口就关闭了。
这是不是在建立一个新窗口然后再隐藏原来的窗口实现?

afan 发表于 2009-8-16 10:18:14

可以先绘出所有窗口,在哪一步显示某窗口,隐藏其它窗口。

顽固不化 发表于 2009-8-16 10:31:26

也可以隐含和显示控件。

顽固不化 发表于 2009-8-16 10:31:44

也可以隐含和显示控件。

afan 发表于 2009-8-16 10:35:18

如果窗口变化不大,直接隐、显控件也很简单。

四海皆狂龙 发表于 2009-8-16 12:59:52

我有多个不同的布局,使用隐、显控件会不会代价高了点(会不会浪费资源)?

lynfr8 发表于 2009-8-16 16:18:54




#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $stp = 1
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("向导窗口演示By PcBar", 450, 221, -1, -1)
$Label1 = GUICtrlCreateLabel("", 16, 16, 400, 20)
GUICtrlSetFont(-1, 12, 600, 0, "楷体_GB2312")
$Edit1 = GUICtrlCreateEdit("", 40, 40, 369, 129, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL), 0)
GUICtrlSetData(-1, "Edit1")
GUICtrlCreateLabel("", 0, 178, 450, 1, $SS_SUNKEN)
$Radio1 = GUICtrlCreateRadio("A.搜索引擎", 120, 64, 113, 25)
$Radio2 = GUICtrlCreateRadio("B.网友介绍", 120, 96, 113, 25)
$Radio3 = GUICtrlCreateRadio("C.传统纸媒", 120, 128, 121, 25)
GUICtrlSetState($Radio1, $gui_hide)
GUICtrlSetState($Radio2, $gui_hide)
GUICtrlSetState($Radio3, $gui_hide)
$Button1 = GUICtrlCreateButton("< 上一步[&B]", 200, 185, 89, 25, 0)
$Button2 = GUICtrlCreateButton("下一步[&N] >", 325, 185, 89, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=
step1(1)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
      Case $GUI_EVENT_CLOSE
            Exit
      Case $Button1
            Call("step" & $stp, 0)
            $stp -= 1
            Call("step" & $stp, 1)
      Case $Button2
            if GUICtrlRead($Button2)="完成[&F]" Then
                Exit
            EndIf
                        
            Call("step" & $stp, 0)
            $stp += 1
            Call("step" & $stp, 1)
            
    EndSwitch
WEnd
Func step1($x)
    If $x = 1 Then
      GUICtrlSetState($Button1, $gui_disable)
      GUICtrlSetData($Label1, "欢迎访问AUTOIT中文站(www.autoitx.com)!")
      GUICtrlSetData($Edit1, @CRLF & "欢迎下载使用本程序,这是一个简单的autoit示例。" & _
                @CRLF & @CRLF & "本程序使用单Form,通过控件操作演示了向导窗口。")
    Else
      GUICtrlSetState($Button1, $gui_enable)
    EndIf
EndFunc   ;==>step1
Func Step2($x)
    If $x = 1 Then
      
      GUICtrlSetData($Label1, "本程序不会收集您的信息,只是显示一下,请放心。")
      GUICtrlSetData($Edit1, @CRLF&"以下是您的电脑配置信息:" & @CRLF & _
                @CRLF & "操作系统:" & @OSVersion & "" & @OSServicePack & "内部版本号: " & @OSBuild & _
                @CRLF & "计算机名称:" & @ComputerName & _
                @CRLF & "当前用户名:" & @UserName & _
                @CRLF & "第一块网卡的IP地址:" & @IPAddress1 & _
                @CRLF & "您的AUTOIT版本:" & @AutoItVersion)
    Else
      
    EndIf
EndFunc   ;==>Step2
Func step3($x)
    If $x = 1 Then
      GUICtrlSetData($Label1, "你是从何处得知本站的?(演示显示/隐藏控件)")
      GUICtrlSetState($Edit1, $gui_hide)
      GUICtrlSetState($Radio1, $gui_show)
      GUICtrlSetState($Radio2, $gui_show)
      GUICtrlSetState($Radio3, $gui_show)
    Else
      GUICtrlSetState($Edit1, $gui_show)
      GUICtrlSetState($Radio1, $gui_hide)
      GUICtrlSetState($Radio2, $gui_hide)
      GUICtrlSetState($Radio3, $gui_hide)
    EndIf
EndFunc   ;==>step3
Func step4($x)
    If $x = 1 Then
      GUICtrlSetData($Button2,"完成[&F]")
      GUICtrlSetData($Label1, "程序演示结束,谢谢!")
      GUICtrlSetData($Edit1, @CRLF & "演示完成." & _
                @CRLF & @CRLF & "作者: PCBAR " & _
                @CRLF & @CRLF & "QQ:45539511" & _
                @CRLF & @CRLF & "2008-08-04")
    Else
      GUICtrlSetData($Button2,"下一步[&N] >")
    EndIf
EndFunc   ;==>step4

lynfr8 发表于 2009-8-16 16:20:49

版主PCBAR写,好像在源码区是要收费的哦
:face (24):

四海皆狂龙 发表于 2009-8-16 17:04:09

看上去,基本原理是,先定义好所有的控件,然后通过开关判断并消隐。
页: [1]
查看完整版本: 如何实现下一步切换到另一个窗口?