找回密码
 加入
搜索
查看: 1668|回复: 0

根据示例修改的脚本,请老师帮忙看看错出在哪里?

  [复制链接]
发表于 2008-10-22 11:14:07 | 显示全部楼层 |阅读模式
我是刚接触AutoIt的,文化低、底子薄,不懂编写规则,只好用修改示例文件的方法来学习。尝试写了下面这个脚本,运行后点击某些控件后,不能隐藏需要隐藏的控件。
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>


_Main()

Func _Main()
        Local $maintree, $aboutitem, $Software, $tools, $Softwarea, $Softwareb
        Local $toola, $toolb, $Softwaregroup,$Softwaregroup2
        Local $aboutlabel, $cancelbutton, $msg
        Local $Inbutton
    Local $Image1
    Local $Image2
    Local $descgroup,$descgroup2

GUICreate("软件安装",640,480,-1,-1,BitOr($WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))

$maintree =    GUICtrlCreateTreeView (10,10,120,450)
$aboutitem =   GUICtrlCreateTreeViewItem ("软件类别",$maintree)
$Software = GUICtrlCreateTreeViewItem ("软件",$maintree)
$tools =   GUICtrlCreateTreeViewItem ("工具",$maintree)
$Softwarea =  GUICtrlCreateTreeViewItem ("软件A",$Software)
$Softwareb =   GUICtrlCreateTreeViewItem ("软件B",$Software)
$toola =     GUICtrlCreateTreeViewItem ("工具A",$tools)
$toolb =    GUICtrlCreateTreeViewItem ("工具B",$tools)
$cancelbutton = GUICtrlCreateButton ("取消",410,430,60,20)
$aboutlabel = GUICtrlCreateLabel ("软件安装 演示.",160,380,180,60)
$Inbutton = GuiCtrlCreateButton("安装", 510, 430, 60, 20)
GUISetState()

;GuiSetState(@SW_SHOW)
        While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton
                                ExitLoop
                        Case $msg = $aboutitem
                                GUICtrlSetState($Image1, $GUI_HIDE)
                                GUICtrlSetState($Image2, $GUI_HIDE)
                                GUICtrlSetState($Softwarea, $GUI_HIDE)
                                GUICtrlSetState($Softwareb, $GUI_HIDE)
                                GUICtrlSetState($descgroup, $GUI_HIDE)
                                GUICtrlSetState($descgroup2, $GUI_HIDE)                               
                                GUICtrlSetState($Softwaregroup, $GUI_HIDE)
                                GUICtrlSetState($Softwaregroup2, $GUI_HIDE)       
                                GUICtrlSetState($Inbutton, $GUI_HIDE)                               
                                GUICtrlSetState($aboutlabel, $GUI_SHOW)
                               
                               
                            Case $msg = $Softwarea
                                GUICtrlSetState($Image2, $GUI_HIDE)
                                GUICtrlSetState($aboutlabel, $GUI_HIDE)
;                                GUICtrlSetState($aboutitem, $GUI_HIDE)
                                GUICtrlSetState($Softwarea, $GUI_SHOW)
                                GUICtrlSetState($Softwareb, $GUI_HIDE)
                                GUICtrlSetState($descgroup2, $GUI_HIDE)                               
                                GUICtrlSetState($Softwaregroup2, $GUI_HIDE)
                               
                            $Image1        = GUICtrlCreatePic("C:\Documents and Settings\Administrator\My Documents\My Pictures\1.jpg", 210, 10, 180, 170)
                            $descgroup = GUICtrlCreateGroup ("详细信息",200,305,350,100)
                GUICtrlSetState(-1, $GUI_SHOW)
                $Softwaregroup = GUICtrlCreateLabel ("软件A,没有添加相关说明...",240,350,300,30)
                $Inbutton = GuiCtrlCreateButton("安装", 510, 430, 60, 20)



                        Case $msg = $Softwareb
                                GUICtrlSetState($Image1, $GUI_HIDE)                               
                                GUICtrlSetState($aboutlabel, $GUI_HIDE)
;                                GUICtrlSetState($aboutitem, $GUI_HIDE)                               
                                GUICtrlSetState($Softwarea, $GUI_HIDE)
                                GUICtrlSetState($Softwareb, $GUI_SHOW)                               
                                GUICtrlSetState($descgroup, $GUI_HIDE)                               
                                GUICtrlSetState($Softwaregroup, $GUI_HIDE)

                                $Image2        = GUICtrlCreatePic("C:\Documents and Settings\Administrator\My Documents\My Pictures\2.jpg", 210, 10, 180, 170)
                $descgroup2 = GUICtrlCreateGroup ("详细信息",200,305,350,100)
                GUICtrlSetState(-1, $GUI_SHOW)
                                $Softwaregroup2 = GUICtrlCreateLabel ("软件B,没有添加相关说明...",240,350,300,30)
                                $Inbutton = GuiCtrlCreateButton("安装", 510, 430, 60, 20)


                EndSelect
        WEnd

        GUIDelete()
        Exit
EndFunc

本帖子中包含更多资源

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

×
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 01:25 , Processed in 0.077894 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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