找回密码
 加入
搜索
查看: 7756|回复: 20

[GUI管理] 高手们请进来看一下啊,实在不知道怎么解决了,很多样式问题,禁用复选框问题

 火.. [复制链接]
发表于 2011-10-11 22:15:23 | 显示全部楼层 |阅读模式
本帖最后由 zlmyongheng 于 2011-10-13 14:14 编辑




1、标签样式列表中只有水平居中,有没有办法实现垂直居中
2、为什么程序运行后滚动条在最下面,不是在最上面
3、待清理的字如何对应到最上面的系统升级补丁备份文件复选框
4、展开项目的后面的待清理如何加,我想把列表收起来,展开心伯,后面出现待清理这几个字,如何加上去,好像一加上去对应的都是别的项目了
5、我用 GUICtrlSetState($tab1_view[1],$GUI_DISABLE)   ;禁用复选框为什么禁 用不掉



代码如下:
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=win.ico
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ListviewConstants.au3>
#include <Array.au3>
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;#Include <GuiListView.au3>
#include <StaticConstants.au3>
#Include <ACN_MISC.au3>
#Include <File.au3>


;Opt('MustDeclareVars', 0)
;声明总的变量
Global $tab,$msg
;声明tab1所用的变量
Global $Tab1,$tab1_view[26],$tab1Label[25],$TreeView1,$tab1button1,$tab1button2,$tab1button3,$tab1button4,$tab1button5,$progressbar1,$i1,$s1,$t1=25,$m,$nMsg,$o,$Number,$Handle,$tab2_list1
;声明tab2所用的变量
Global $tab2,$tab2_view[13],$tab2Label[12],$TreeView2,$tab2button1,$tab2button2,$tab2button3,$tab2button4,$tab2button5,$progressbar2,$i2,$s2,$t2=12,$text
Global $CookiesAddress,$TemplatesAddress,$RecentAddress,$CacheAddress,$PrintHoodAddress,$HistoryAddress,$DiskRecycle,$x,$iStyle,$tstyle
Global $dir_prefix, $dir_number,$cp_path,$path,$i,$file_number,$file_prefix
;定义风格
;定义树列表风格
$iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
If WinExists("windows7封装辅助工具") Then
        MsgBox(32,"","程序已运行,请返回。")
        Exit
EndIf
win7tools()
Func win7tools()
        ;创建窗体
        GUICreate("windows7封装辅助工具",440,440,-1,-1,0x00C00000)  
        ;GUISetBkColor(0x00E0FFFF)
        ;设置字体
        GUISetFont(9, 300)
     
         $tab = GUICtrlCreateTab(10, 10, 420, 20)
     
         $progressbar1=GUICtrlCreateProgress (10, 365, 420,20)
         
        $Tab1 = GUICtrlCreateTabItem("系统减肥")
        $TreeView1 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle, $WS_EX_CLIENTEDGE)
        $tab1button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
        $tab1button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
    $tab1button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
    $tab1button4=GUICtrlCreateButton("清理", 290, 400, 70, 20)
        $tab1button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
   
   $tab1_label1=GUICtrlCreateLabel("   项具名称                |状态                 |说明", 10, 30,420,24,$WS_BORDER)
          
                $tab1_view[1]=GUICtrlCreateTreeViewItem("系统升级补丁备份文件",$TreeView1)
                $tab1_view[2]=GUICtrlCreateTreeViewItem("用户公用文件",$TreeView1)
                $tab1_view[3]=GUICtrlCreateTreeViewItem("系统自带壁纸和主题",$TreeView1)
                $tab1_view[4]=GUICtrlCreateTreeViewItem("不同语言启动界面",$TreeView1)
                $tab1_view[5]=GUICtrlCreateTreeViewItem("程序安装解压目录",$TreeView1)
                $tab1_view[6]=GUICtrlCreateTreeViewItem("不常用的输入法",$TreeView1)
                $tab1_view[7]=GUICtrlCreateTreeViewItem("系统帮助文件",$TreeView1)
                $tab1_view[8]=GUICtrlCreateTreeViewItem("系统测试记录文件",$TreeView1)
                $tab1_view[9]=GUICtrlCreateTreeViewItem("驱动精减",$TreeView1)
                $tab1_view[10]=GUICtrlCreateTreeViewItem("系统相关组件",$TreeView1)
                $tab1_view[11]=GUICtrlCreateTreeViewItem("Table PC组件",$tab1_view[10])
                $tab1_view[12]=GUICtrlCreateTreeViewItem("Windows自带游戏",$tab1_view[10])
                $tab1_view[13]=GUICtrlCreateTreeViewItem("DVD Maker",$tab1_view[10])
                $tab1_view[14]=GUICtrlCreateTreeViewItem("媒体中心",$tab1_view[10])
                $tab1_view[15]=GUICtrlCreateTreeViewItem("远程差分压缩",$tab1_view[10])
                $tab1_view[16]=GUICtrlCreateTreeViewItem("XPS相关组件",$tab1_view[10])
                $tab1_view[17]=GUICtrlCreateTreeViewItem("系统垃圾文件清理",$TreeView1)
                $tab1_view[18]=GUICtrlCreateTreeViewItem("回收站文件",$tab1_view[17])
                $tab1_view[19]=GUICtrlCreateTreeViewItem("临时目录文件",$tab1_view[17])
                $tab1_view[20]=GUICtrlCreateTreeViewItem("程序打开文件记录",$tab1_view[17])
                $tab1_view[21]=GUICtrlCreateTreeViewItem("索引文件记录",$tab1_view[17])
                $tab1_view[22]=GUICtrlCreateTreeViewItem("预读缓存文件",$tab1_view[17])
                $tab1_view[23]=GUICtrlCreateTreeViewItem("IE临时文件",$tab1_view[17])
                $tab1_view[24]=GUICtrlCreateTreeViewItem("IE历史记录文件",$tab1_view[17])
                $tab1_view[25]=GUICtrlCreateTreeViewItem("Cookie文件",$tab1_view[17])
               
                GUICtrlSetState($tab1_view[1],$GUI_DISABLE);为什么禁 用不掉
               
                GUICtrlSetState($tab1_view[10], $GUI_EXPAND)
                GUICtrlSetState($tab1_view[17], $GUI_EXPAND)
        default_select1()
            
                            
           
                  
          $tab1Label[1]=GUICtrlCreateLabel ("待清理", 354, 56)
          $tab1Label[2]=GUICtrlCreateLabel ("待清理", 354, 76)
          $tab1Label[3]=GUICtrlCreateLabel ("待清理", 354, 90)
          $tab1Label[4]=GUICtrlCreateLabel ("待清理", 354, 104)
          $tab1Label[5]=GUICtrlCreateLabel ("待清理", 354, 118)
          $tab1Label[6]=GUICtrlCreateLabel ("待清理", 354, 132)
          $tab1Label[7]=GUICtrlCreateLabel ("待清理", 354, 146)
          $tab1Label[8]=GUICtrlCreateLabel ("待清理", 354, 160)
          $tab1Label[9]=GUICtrlCreateLabel ("待清理", 354, 174)
          $tab1Label[10]=GUICtrlCreateLabel ("待清理", 354, 188)
          $tab1Label[11]=GUICtrlCreateLabel ("待清理", 354, 202)
          $tab1Label[12]=GUICtrlCreateLabel ("待清理", 354, 216)
          $tab1Label[13]=GUICtrlCreateLabel ("待清理", 354, 230)
          $tab1Label[14]=GUICtrlCreateLabel ("待清理", 354, 244)
         

         $tab2=GUICtrlCreateTabItem("封装优化")
                $TreeView2 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle,$WS_EX_CLIENTEDGE)
                $tab2_view[1]=GUICtrlCreateTreeViewItem("关闭系统休眠",$TreeView2)
                $tab2_view[2]=GUICtrlCreateTreeViewItem("关闭UAC",$TreeView2)
                $tab2_view[3]=GUICtrlCreateTreeViewItem("关闭错误报告",$TreeView2)
                $tab2_view[4]=GUICtrlCreateTreeViewItem("关闭自动更新",$TreeView2)
                $tab2_view[5]=GUICtrlCreateTreeViewItem("任务栏始终显示所有图标",$TreeView2)
                $tab2_view[6]=GUICtrlCreateTreeViewItem("关闭自动播放",$TreeView2)
                $tab2_view[7]=GUICtrlCreateTreeViewItem("桌面显示常用图标",$TreeView2)
                $tab2_view[8]=GUICtrlCreateTreeViewItem("右键增加管理权限",$TreeView2)
                $tab2_view[9]=GUICtrlCreateTreeViewItem("计算机中增加视频设备",$TreeView2)
                $tab2_view[10]=GUICtrlCreateTreeViewItem("删除操作中心图标",$TreeView2)
                $tab2_view[11]=GUICtrlCreateTreeViewItem("不从网络搜索驱动",$TreeView2)
                $tab2_view[12]=GUICtrlCreateTreeViewItem("禁用远程协助",$TreeView2)

                $tab2button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
                $tab2button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
                $tab2button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
                $tab2button4=GUICtrlCreateButton("优化", 290, 400, 70, 20)
                $tab2button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
                $tab2_list1=GUICtrlCreateListView("     项具名称 |状态    |说明", 10, 30,420,24,$LVS_NOSORTHEADER)
         
               
      
               

;运行tab2的默认选择
         default_select2()
               
         $tab2Label[1]=GUICtrlCreateLabel ("待清理", 354, 55)
         $tab2Label[2]=GUICtrlCreateLabel ("待清理", 354, 75)
         $tab2Label[3]=GUICtrlCreateLabel ("待清理", 354, 95)
         $tab2Label[4]=GUICtrlCreateLabel ("待清理", 354, 115)
         $tab2Label[5]=GUICtrlCreateLabel ("待清理", 354, 135)
         $tab2Label[6]=GUICtrlCreateLabel ("待清理", 354, 155)
         $tab2Label[7]=GUICtrlCreateLabel ("待清理", 354, 175)
         $tab2Label[8]=GUICtrlCreateLabel ("待清理", 354, 195)
         $progressbar2=GUICtrlCreateProgress (10, 365, 420,20)
        GUISetState()
               

       
               
        While 1
               
                $msg = GUIGetMsg()
        ;此段定义父项目勾选 ,子项目也勾选
        Select
                Case $Msg = $tab1_view[10]
                       
          ;MsgBox(0,"debug", GUICtrlRead($tab1_view[10]))
                         if GUICtrlRead($tab1_view[10])=1281 or GUICtrlRead($tab1_view[10])= 257 Then      
                       
                 For $m=11 To 16
          GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
        Next
        ElseIf GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=260 Then
                       
                For $m=11 To 16
           GUICtrlSetState($tab1_view[$m], $GUI_UNCHECKED)
        Next
        EndIf
       
Case $Msg = $tab1_view[17]
If         GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=257 Then
     
         For $m=18 To 25
           GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
                  ; MsgBox(0,"",GUICtrlRead($tab1_view[$M]))
         Next

        ElseIf        GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=260 Then ;反选
   
           For $m=18 To 25
          GUICtrlSetState($tab1_view[$m],  $GUI_UNCHECKED)
                Next
        EndIf
EndSelect



;此段定义子项目勾选,父项目也跟着勾选,子项目全部取消,父项目也跟着取消
$n=0
For $m=11 To 16
        If GUICtrlRead($tab1_view[10])=1281 Or GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=257 Or GUICtrlRead($tab1_view[10])=260   then exitloop
                If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
                        GUICtrlSetState($tab1_view[10],  $GUI_CHECKED)
                EndIf
       
                If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then  $n=$n+1
                If $n=6 Then GUICtrlSetState($tab1_view[10],  $GUI_UNCHECKED)               
                       
Next
       

$n=0
For $m=18 To 25
        If GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=257 Or GUICtrlRead($tab1_view[17])=260  then exitloop
If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
                        GUICtrlSetState($tab1_view[17],  $GUI_CHECKED)
                EndIf
       
                If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then  $n=$n+1
                       
                If $n=8 Then GUICtrlSetState($tab1_view[17],  $GUI_UNCHECKED)               
Next

                If $msg = $Tab1button1  Then all_select1()
        If $msg = $Tab1button2  Then all_none1()
        If $msg = $tab1button3  Then default_select1()
        If $msg = $tab1button4  Then clean1()
                If $msg = $Tab1button5  Then ExitLoop
               
        If $msg = $Tab2button1  Then all_select2()
        If $msg = $Tab2button2  Then all_none2()
        If $msg = $Tab2button3  Then default_select2()
            If $msg = $Tab2button4  Then clean2()
        If $msg = $Tab2button5  Then ExitLoop
               
        WEnd
EndFunc   ;==>win7tools








;实现tab1按钮功能

;实现全选功能
Func all_select1()
    GUICtrlSetState($tab1button1,$GUI_DISABLE)
               For $i1 =1 to $t1
             GUICtrlSetState($tab1_view[$i1],$GUI_CHECKED)
             Next
    GUICtrlSetState($tab1button1,$GUI_ENABLE)               
EndFunc

;实现全部不选择功能
Func all_none1()
               For $i1 =1 to $t1
             GUICtrlSetState($Tab1_view[$i1],$GUI_UNCHECKED)
             Next
EndFunc






;实现默认选择功能
Func default_select1()
    GUICtrlSetState($tab1button3,$GUI_DISABLE)
               all_none1()
                 
                 GUICtrlSetState($tab1_view[1],$GUI_CHECKED)
                 GUICtrlSetState($tab1_view[2],$GUI_CHECKED)
                 GUICtrlSetState($tab1_view[4],$GUI_CHECKED)
         GUICtrlSetState($tab1_view[6],$GUI_CHECKED)
               
    GUICtrlSetState($tab1button3,$GUI_ENABLE)   
EndFunc


;tab1清理功能
Func clean1()
     Check1()
select
Case $s1=$t1
       MsgBox(0, "提示", "请选择要清理的项目!@_@")
Case $s1<$t1
    GUICtrlSetState($tab1button4,$GUI_DISABLE)
        For $i1=1 To $t1
                If GUICtrlRead($Tab1_view[$i1]) =1 Or GUICtrlRead($Tab1_view[$i1])=257 Then
                       
                   Call('Tab1_view'&$i1)
                GUICtrlSetState('Tab1_view'&$i1,$GUI_DISABLE)
        EndIf
       
           GUICtrlSetData($progressbar1,100/25*$i1)
        Next
       
    MsgBox ( 0, "提示", "所选择的项目清理完毕!^_^")
        GUICtrlSetData($progressbar1,0)
EndSelect
     GUICtrlSetState($tab1button4,$GUI_ENABLE)   
EndFunc

;检查用户是否没有选择任何选项,而直接点击清理的tab1
Func  check1()
            $s1=0
        For $i1 =1 to $t1
             If  GUICtrlRead($Tab1_view[$i1])<>1 And GUICtrlRead($Tab1_view[$i1])<>257 Then $s1=$s1+1
                Next
EndFunc       

;实现全选功能tab2
Func all_select2()
         GUICtrlSetState($tab2button1,$GUI_DISABLE)
               For $i2 =1 to 12
             GUICtrlSetState($tab2_view[$i2],$GUI_CHECKED)
         Next       
          GUICtrlSetState($tab2button1,$GUI_ENABLE)         
EndFunc



;实现全部不选功能tab2
Func all_none2()
               For $i2 =1 to $t2
             GUICtrlSetState($tab2_view[$i2],$GUI_UNCHECKED)
         Next
EndFunc


;实现默认选择功能tab2
Func default_select2()
                GUICtrlSetState($tab2button3,$GUI_DISABLE)
                      all_none2()   
                GUICtrlSetState($tab2_view[1],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[2],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[3],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[5],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[6],$GUI_CHECKED)       
                GUICtrlSetState($tab2_view[11],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[12],$GUI_CHECKED)                               
                GUICtrlSetState($tab2button3,$GUI_ENABLE)         
         
EndFunc

;清理开始tab2
Func clean2()
     Check2()
select
Case $s2=$t2
       MsgBox(0, "提示", "请选择要优化的项目!@_@")
Case $s2<$t2
     GUICtrlSetState($tab2button4,$GUI_DISABLE)
        For $i2=1 To $t2
                If GUICtrlRead($Tab2_view[$i2]) = 1 Or GUICtrlRead($Tab2_view[$i2])=257 Then
                       
                   Call('Tab2_view'&$i2)
           EndIf
           GUICtrlSetData($progressbar1,100/12*$i2)
        Next
            
    MsgBox ( 0, "提示", "所选择的项目优化完毕!^_^")
        GUICtrlSetData($progressbar2,0)
EndSelect
        GUICtrlSetState($tab2button4,$GUI_ENABLE)   
EndFunc

;检查用户是否没有选择任何选项,而直接点击tab2的清理
Func  check2()
        $s2=0
        For $i2 =1 to $t2
        If GUICtrlRead($tab2_view[$i2])<>1 And GUICtrlRead($tab2_view[$i2])<>257 Then $s2=$s2+1   
        Next
EndFunc

本帖子中包含更多资源

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

×
发表于 2011-10-12 22:12:01 | 显示全部楼层
谢谢老大,哈哈,老大出面就是不一样啊

评分

参与人数 1金钱 -20 贡献 -1 收起 理由
afan -20 -1

查看全部评分

 楼主| 发表于 2011-10-14 18:16:06 | 显示全部楼层
老大们,进来帮个忙啊
发表于 2011-10-14 20:16:32 | 显示全部楼层
帮不上忙。。不过帮顶下!
发表于 2011-10-14 20:42:19 | 显示全部楼层
gui 这种东西 “不写不知道,一写吓一跳。”
复杂程度远超你想象,整理代码后用代码方式再发一下吧
 楼主| 发表于 2011-10-15 02:45:09 | 显示全部楼层
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=win.ico
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ListviewConstants.au3>
#include <Array.au3>
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;#Include <GuiListView.au3>
#include <StaticConstants.au3>
#Include <ACN_MISC.au3>
#Include <File.au3>


;Opt('MustDeclareVars', 0)
;声明总的变量
Global $tab,$msg
;声明tab1所用的变量
Global $Tab1,$tab1_view[26],$tab1Label[25],$TreeView1,$tab1button1,$tab1button2,$tab1button3,$tab1button4,$tab1button5,$progressbar1,$i1,$s1,$t1=25,$m,$nMsg,$o,$Number,$Handle,$tab2_list1
;声明tab2所用的变量
Global $tab2,$tab2_view[13],$tab2Label[12],$TreeView2,$tab2button1,$tab2button2,$tab2button3,$tab2button4,$tab2button5,$progressbar2,$i2,$s2,$t2=12,$text
Global $CookiesAddress,$TemplatesAddress,$RecentAddress,$CacheAddress,$PrintHoodAddress,$HistoryAddress,$DiskRecycle,$x,$iStyle,$tstyle
Global $dir_prefix, $dir_number,$cp_path,$path,$i,$file_number,$file_prefix
;定义风格
;定义树列表风格
$iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
If WinExists("windows7封装辅助工具") Then
        MsgBox(32,"","程序已运行,请返回。")
        Exit 
EndIf
win7tools()
Func win7tools()
        ;创建窗体
        GUICreate("windows7封装辅助工具",440,440,-1,-1,0x00C00000)  
       ;设置字体
        GUISetFont(9, 300)
     
         $tab = GUICtrlCreateTab(10, 10, 420, 20)
     
         $progressbar1=GUICtrlCreateProgress (10, 365, 420,20)
         
        $Tab1 = GUICtrlCreateTabItem("系统减肥")
        $TreeView1 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle, $WS_EX_CLIENTEDGE)
        $tab1button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
        $tab1button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
    $tab1button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
    $tab1button4=GUICtrlCreateButton("清理", 290, 400, 70, 20)
        $tab1button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
    
   $tab1_label1=GUICtrlCreateLabel("   项具名称                |状态                 |说明", 10, 30,420,24,$WS_BORDER) 
          
                $tab1_view[1]=GUICtrlCreateTreeViewItem("系统升级补丁备份文件",$TreeView1)
                $tab1_view[2]=GUICtrlCreateTreeViewItem("用户公用文件",$TreeView1)
                $tab1_view[3]=GUICtrlCreateTreeViewItem("系统自带壁纸和主题",$TreeView1)
                $tab1_view[4]=GUICtrlCreateTreeViewItem("不同语言启动界面",$TreeView1)
                $tab1_view[5]=GUICtrlCreateTreeViewItem("程序安装解压目录",$TreeView1)
                $tab1_view[6]=GUICtrlCreateTreeViewItem("不常用的输入法",$TreeView1)
                $tab1_view[7]=GUICtrlCreateTreeViewItem("系统帮助文件",$TreeView1)
                $tab1_view[8]=GUICtrlCreateTreeViewItem("系统测试记录文件",$TreeView1)
                $tab1_view[9]=GUICtrlCreateTreeViewItem("驱动精减",$TreeView1)
                $tab1_view[10]=GUICtrlCreateTreeViewItem("系统相关组件",$TreeView1)
                $tab1_view[11]=GUICtrlCreateTreeViewItem("Table PC组件",$tab1_view[10])
                $tab1_view[12]=GUICtrlCreateTreeViewItem("Windows自带游戏",$tab1_view[10])
                $tab1_view[13]=GUICtrlCreateTreeViewItem("DVD Maker",$tab1_view[10])
                $tab1_view[14]=GUICtrlCreateTreeViewItem("媒体中心",$tab1_view[10])
                $tab1_view[15]=GUICtrlCreateTreeViewItem("远程差分压缩",$tab1_view[10])
                $tab1_view[16]=GUICtrlCreateTreeViewItem("XPS相关组件",$tab1_view[10])
                $tab1_view[17]=GUICtrlCreateTreeViewItem("系统垃圾文件清理",$TreeView1)
                $tab1_view[18]=GUICtrlCreateTreeViewItem("回收站文件",$tab1_view[17])
                $tab1_view[19]=GUICtrlCreateTreeViewItem("临时目录文件",$tab1_view[17])
                $tab1_view[20]=GUICtrlCreateTreeViewItem("程序打开文件记录",$tab1_view[17]) 
                $tab1_view[21]=GUICtrlCreateTreeViewItem("索引文件记录",$tab1_view[17]) 
                $tab1_view[22]=GUICtrlCreateTreeViewItem("预读缓存文件",$tab1_view[17])
                $tab1_view[23]=GUICtrlCreateTreeViewItem("IE临时文件",$tab1_view[17])
                $tab1_view[24]=GUICtrlCreateTreeViewItem("IE历史记录文件",$tab1_view[17])
                $tab1_view[25]=GUICtrlCreateTreeViewItem("Cookie文件",$tab1_view[17])
                
                GUICtrlSetState($tab1_view[1],$GUI_DISABLE);为什么禁 用不掉
                
                GUICtrlSetState($tab1_view[10], $GUI_EXPAND)
                GUICtrlSetState($tab1_view[17], $GUI_EXPAND)
        default_select1() 
          $tab1Label[1]=GUICtrlCreateLabel ("待清理", 354, 56)
          $tab1Label[2]=GUICtrlCreateLabel ("待清理", 354, 76)
          $tab1Label[3]=GUICtrlCreateLabel ("待清理", 354, 90)
          $tab1Label[4]=GUICtrlCreateLabel ("待清理", 354, 104)
          $tab1Label[5]=GUICtrlCreateLabel ("待清理", 354, 118)
          $tab1Label[6]=GUICtrlCreateLabel ("待清理", 354, 132)
          $tab1Label[7]=GUICtrlCreateLabel ("待清理", 354, 146)
          $tab1Label[8]=GUICtrlCreateLabel ("待清理", 354, 160)
          $tab1Label[9]=GUICtrlCreateLabel ("待清理", 354, 174)
          $tab1Label[10]=GUICtrlCreateLabel ("待清理", 354, 188)
          $tab1Label[11]=GUICtrlCreateLabel ("待清理", 354, 202)
          $tab1Label[12]=GUICtrlCreateLabel ("待清理", 354, 216)
          $tab1Label[13]=GUICtrlCreateLabel ("待清理", 354, 230)
          $tab1Label[14]=GUICtrlCreateLabel ("待清理", 354, 244)
          

         $tab2=GUICtrlCreateTabItem("封装优化")
                $TreeView2 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle,$WS_EX_CLIENTEDGE)
                $tab2_view[1]=GUICtrlCreateTreeViewItem("关闭系统休眠",$TreeView2)
                $tab2_view[2]=GUICtrlCreateTreeViewItem("关闭UAC",$TreeView2)
                $tab2_view[3]=GUICtrlCreateTreeViewItem("关闭错误报告",$TreeView2)
                $tab2_view[4]=GUICtrlCreateTreeViewItem("关闭自动更新",$TreeView2)
                $tab2_view[5]=GUICtrlCreateTreeViewItem("任务栏始终显示所有图标",$TreeView2)
                $tab2_view[6]=GUICtrlCreateTreeViewItem("关闭自动播放",$TreeView2)
                $tab2_view[7]=GUICtrlCreateTreeViewItem("桌面显示常用图标",$TreeView2)
                $tab2_view[8]=GUICtrlCreateTreeViewItem("右键增加管理权限",$TreeView2)
                $tab2_view[9]=GUICtrlCreateTreeViewItem("计算机中增加视频设备",$TreeView2)
                $tab2_view[10]=GUICtrlCreateTreeViewItem("删除操作中心图标",$TreeView2)
                $tab2_view[11]=GUICtrlCreateTreeViewItem("不从网络搜索驱动",$TreeView2)
                $tab2_view[12]=GUICtrlCreateTreeViewItem("禁用远程协助",$TreeView2)

                $tab2button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
                $tab2button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
                $tab2button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
                $tab2button4=GUICtrlCreateButton("优化", 290, 400, 70, 20)
                $tab2button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
                $tab2_list1=GUICtrlCreateListView("     项具名称 |状态    |说明", 10, 30,420,24,$LVS_NOSORTHEADER) 
         
                
      
                

;运行tab2的默认选择
         default_select2()
                
         $tab2Label[1]=GUICtrlCreateLabel ("待清理", 354, 55)
         $tab2Label[2]=GUICtrlCreateLabel ("待清理", 354, 75)
         $tab2Label[3]=GUICtrlCreateLabel ("待清理", 354, 95)
         $tab2Label[4]=GUICtrlCreateLabel ("待清理", 354, 115)
         $tab2Label[5]=GUICtrlCreateLabel ("待清理", 354, 135)
         $tab2Label[6]=GUICtrlCreateLabel ("待清理", 354, 155)
         $tab2Label[7]=GUICtrlCreateLabel ("待清理", 354, 175)
         $tab2Label[8]=GUICtrlCreateLabel ("待清理", 354, 195)
         $progressbar2=GUICtrlCreateProgress (10, 365, 420,20)
        GUISetState()
                

        
                
        While 1
                
                $msg = GUIGetMsg()
        ;此段定义父项目勾选 ,子项目也勾选
        Select
                Case $Msg = $tab1_view[10] 
                        
          ;MsgBox(0,"debug", GUICtrlRead($tab1_view[10]))
                         if GUICtrlRead($tab1_view[10])=1281 or GUICtrlRead($tab1_view[10])= 257 Then       
                        
                 For $m=11 To 16
          GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
        Next
        ElseIf GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=260 Then
                        
                For $m=11 To 16
           GUICtrlSetState($tab1_view[$m], $GUI_UNCHECKED)
        Next
        EndIf
        
Case $Msg = $tab1_view[17]
If         GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=257 Then
     
         For $m=18 To 25
           GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
                  ; MsgBox(0,"",GUICtrlRead($tab1_view[$M]))
         Next

        ElseIf        GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=260 Then ;反选
    
           For $m=18 To 25
          GUICtrlSetState($tab1_view[$m],  $GUI_UNCHECKED)
                Next
        EndIf
EndSelect



;此段定义子项目勾选,父项目也跟着勾选,子项目全部取消,父项目也跟着取消
$n=0
For $m=11 To 16
        If GUICtrlRead($tab1_view[10])=1281 Or GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=257 Or GUICtrlRead($tab1_view[10])=260   then exitloop
                If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
                        GUICtrlSetState($tab1_view[10],  $GUI_CHECKED)
                EndIf
        
                If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then  $n=$n+1
                If $n=6 Then GUICtrlSetState($tab1_view[10],  $GUI_UNCHECKED)                
                        
Next
        

$n=0
For $m=18 To 25
        If GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=257 Or GUICtrlRead($tab1_view[17])=260  then exitloop
If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
                        GUICtrlSetState($tab1_view[17],  $GUI_CHECKED)
                EndIf
        
                If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then  $n=$n+1
                        
                If $n=8 Then GUICtrlSetState($tab1_view[17],  $GUI_UNCHECKED)                
Next

                If $msg = $Tab1button1  Then all_select1()
        If $msg = $Tab1button2  Then all_none1()
        If $msg = $tab1button3  Then default_select1()
        If $msg = $tab1button4  Then clean1()
                If $msg = $Tab1button5  Then ExitLoop
                
        If $msg = $Tab2button1  Then all_select2()
        If $msg = $Tab2button2  Then all_none2()
        If $msg = $Tab2button3  Then default_select2()
            If $msg = $Tab2button4  Then clean2()
        If $msg = $Tab2button5  Then ExitLoop
                
        WEnd
EndFunc   ;==>win7tools








;实现tab1按钮功能

;实现全选功能
Func all_select1()
    GUICtrlSetState($tab1button1,$GUI_DISABLE)
               For $i1 =1 to $t1
             GUICtrlSetState($tab1_view[$i1],$GUI_CHECKED)
             Next
    GUICtrlSetState($tab1button1,$GUI_ENABLE)               
EndFunc

;实现全部不选择功能
Func all_none1()
               For $i1 =1 to $t1
             GUICtrlSetState($Tab1_view[$i1],$GUI_UNCHECKED)
             Next
EndFunc






;实现默认选择功能
Func default_select1()
    GUICtrlSetState($tab1button3,$GUI_DISABLE)
               all_none1() 
                 
                 GUICtrlSetState($tab1_view[1],$GUI_CHECKED)
                 GUICtrlSetState($tab1_view[2],$GUI_CHECKED)
                 GUICtrlSetState($tab1_view[4],$GUI_CHECKED)
         GUICtrlSetState($tab1_view[6],$GUI_CHECKED)
               
    GUICtrlSetState($tab1button3,$GUI_ENABLE)    
EndFunc


;tab1清理功能
Func clean1()
     Check1()
select 
Case $s1=$t1
       MsgBox(0, "提示", "请选择要清理的项目!@_@")
Case $s1<$t1
    GUICtrlSetState($tab1button4,$GUI_DISABLE)
        For $i1=1 To $t1
                If GUICtrlRead($Tab1_view[$i1]) =1 Or GUICtrlRead($Tab1_view[$i1])=257 Then
                        
                   Call('Tab1_view'&$i1)
                GUICtrlSetState('Tab1_view'&$i1,$GUI_DISABLE)
        EndIf
        
           GUICtrlSetData($progressbar1,100/25*$i1)
        Next
        
    MsgBox ( 0, "提示", "所选择的项目清理完毕!^_^")
        GUICtrlSetData($progressbar1,0)
EndSelect
     GUICtrlSetState($tab1button4,$GUI_ENABLE)    
EndFunc

;检查用户是否没有选择任何选项,而直接点击清理的tab1
Func  check1()
            $s1=0
        For $i1 =1 to $t1
             If  GUICtrlRead($Tab1_view[$i1])<>1 And GUICtrlRead($Tab1_view[$i1])<>257 Then $s1=$s1+1
                Next
EndFunc        

;实现全选功能tab2
Func all_select2()
         GUICtrlSetState($tab2button1,$GUI_DISABLE)
               For $i2 =1 to 12
             GUICtrlSetState($tab2_view[$i2],$GUI_CHECKED)
         Next        
          GUICtrlSetState($tab2button1,$GUI_ENABLE)         
EndFunc



;实现全部不选功能tab2
Func all_none2()
               For $i2 =1 to $t2
             GUICtrlSetState($tab2_view[$i2],$GUI_UNCHECKED)
         Next
EndFunc


;实现默认选择功能tab2
Func default_select2()
                GUICtrlSetState($tab2button3,$GUI_DISABLE)
                      all_none2()    
                GUICtrlSetState($tab2_view[1],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[2],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[3],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[5],$GUI_CHECKED) 
                GUICtrlSetState($tab2_view[6],$GUI_CHECKED)        
                GUICtrlSetState($tab2_view[11],$GUI_CHECKED)
                GUICtrlSetState($tab2_view[12],$GUI_CHECKED)                                
                GUICtrlSetState($tab2button3,$GUI_ENABLE)         
         
EndFunc

;清理开始tab2
Func clean2()
     Check2()
select 
Case $s2=$t2
       MsgBox(0, "提示", "请选择要优化的项目!@_@")
Case $s2<$t2
     GUICtrlSetState($tab2button4,$GUI_DISABLE)
        For $i2=1 To $t2
                If GUICtrlRead($Tab2_view[$i2]) = 1 Or GUICtrlRead($Tab2_view[$i2])=257 Then
                        
                   Call('Tab2_view'&$i2)
           EndIf
           GUICtrlSetData($progressbar1,100/12*$i2)
        Next
            
    MsgBox ( 0, "提示", "所选择的项目优化完毕!^_^")
        GUICtrlSetData($progressbar2,0)
EndSelect
        GUICtrlSetState($tab2button4,$GUI_ENABLE)    
EndFunc

;检查用户是否没有选择任何选项,而直接点击tab2的清理
Func  check2()
        $s2=0
        For $i2 =1 to $t2
        If GUICtrlRead($tab2_view[$i2])<>1 And GUICtrlRead($tab2_view[$i2])<>257 Then $s2=$s2+1    
        Next
EndFunc
发表于 2011-10-15 03:17:14 | 显示全部楼层
帮顶。,无能为力。
发表于 2011-10-15 03:41:43 | 显示全部楼层
下载试试,GUI很难搞的
发表于 2011-10-15 15:25:42 | 显示全部楼层
学习了,太有用了
 楼主| 发表于 2011-10-16 20:21:04 | 显示全部楼层
仍然没有解决,自己也在思考这个问题,感觉无从下手
发表于 2011-10-16 22:50:14 | 显示全部楼层
程序的结构有点乱,看得糊涂。
能否先简化一些。
发表于 2011-10-16 23:33:15 | 显示全部楼层
$tab1_label1=GUICtrlCreateLabel("   项具名称                |状态                 |说明", 10, 30,420,24,$WS_BORDER & $BS_VCENTER )
 楼主| 发表于 2011-10-17 19:24:21 | 显示全部楼层
没用的啊,$BS_VCENTER ,这个是按钮的样式,不是label的样式啊
发表于 2011-10-17 19:32:58 | 显示全部楼层
垂直居中: $SS_CENTERIMAGE
不过,在树形控件上重叠Label控件这种搞法肯定是不行的… 滚动条一移动注定会抹掉,光这一点,LZ就该另想办法了
 楼主| 发表于 2011-10-18 06:07:32 | 显示全部楼层
有什么方法可以搞定这种,这也是一种技术啊,想了好多方法,都没有搞定
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-12 16:01 , Processed in 0.091164 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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