找回密码
 加入
搜索
查看: 2506|回复: 8

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

[复制链接]
发表于 2009-8-16 06:54:08 | 显示全部楼层 |阅读模式
象安装程序一样,按下一步就可以切换到另一个窗口,原来的窗口就关闭了。
这是不是在建立一个新窗口然后再隐藏原来的窗口实现?
发表于 2009-8-16 10:18:14 | 显示全部楼层
可以先绘出所有窗口,在哪一步显示某窗口,隐藏其它窗口。
发表于 2009-8-16 10:31:26 | 显示全部楼层
也可以隐含和显示控件。
发表于 2009-8-16 10:31:44 | 显示全部楼层
也可以隐含和显示控件。
发表于 2009-8-16 10:35:18 | 显示全部楼层
如果窗口变化不大,直接隐、显控件也很简单。
 楼主| 发表于 2009-8-16 12:59:52 | 显示全部楼层
我有多个不同的布局,使用隐、显控件会不会代价高了点(会不会浪费资源)?
发表于 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  

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 1金钱 +2 收起 理由
四海皆狂龙 + 2 谢谢提供!

查看全部评分

发表于 2009-8-16 16:20:49 | 显示全部楼层
版主PCBAR写,好像在源码区是要收费的哦
 楼主| 发表于 2009-8-16 17:04:09 | 显示全部楼层
看上去,基本原理是,先定义好所有的控件,然后通过开关判断并消隐。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 23:19 , Processed in 0.081302 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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