|
发表于 2008-8-28 16:04:42
|
显示全部楼层
这是我以前刚学au3的时候写的,我去掉了一些代码,以便更好地说明你的问题,你再自己整理一下吧。
[au3]#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <TreeViewConstants.au3>
#include <StaticConstants.au3>
AutoItSetOption("WinTitleMatchMode", -4)
Global $treeview, $fonts, $font1, $font2, $font3, $papers, $paper1, $paper2, $paper3, $Install, $Cancel, $msg
GUICreate("安装字体 -- Mo Hong", 260, 210)
GUICtrlCreateLabel("请勾选您想要安装的组件:", 40, 15)
$treeview = GUICtrlCreateTreeView(40, 35, 180, 120, BitOR($TVS_HASBUTTONS, $TVS_CHECKBOXES, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$fonts = GUICtrlCreateTreeViewItem("字体", $treeview)
$font1 = GUICtrlCreateTreeViewItem("仿宋_GB2312", $fonts)
GUICtrlSetState(-1, $GUI_CHECKED)
$font2 = GUICtrlCreateTreeViewItem("经典黑体", $fonts)
GUICtrlSetState(-1, $GUI_CHECKED)
$font3 = GUICtrlCreateTreeViewItem("楷体_GB2312", $fonts)
GUICtrlSetState($fonts, $GUI_EXPAND)
GUICtrlCreateLabel("", 0, 165, 260, 2, $SS_SUNKEN)
$Install = GUICtrlCreateButton("安装(&I)", 40, 175, 80, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetState(-1, $GUI_FOCUS)
$Cancel = GUICtrlCreateButton("取消(&C)", 140, 175, 80, 25)
GUISetState()
While 1
Switch GUIGetMsg()
Case $Cancel, $GUI_EVENT_CLOSE
Exit
Case $fonts
If BitAnd(GUICtrlRead($fonts),$GUI_CHECKED) Then
GUICtrlSetState($font1, $GUI_CHECKED)
GUICtrlSetState($font2, $GUI_CHECKED)
GUICtrlSetState($font3, $GUI_CHECKED)
ElseIf BitAnd(GUICtrlRead($fonts),$GUI_UNCHECKED) Then
GUICtrlSetState($font1, $GUI_UNCHECKED)
GUICtrlSetState($font2, $GUI_UNCHECKED)
GUICtrlSetState($font3, $GUI_UNCHECKED)
EndIf
Case $font1, $font2, $font3
If BitAnd(GUICtrlRead($font1),$GUI_UNCHECKED) Or BitAnd(GUICtrlRead($font2),$GUI_UNCHECKED) Or BitAnd(GUICtrlRead($font3),$GUI_UNCHECKED) Then
GUICtrlSetState($fonts, $GUI_UNCHECKED)
ElseIf BitAnd(GUICtrlRead($font1),$GUI_CHECKED) And BitAnd(GUICtrlRead($font2),$GUI_CHECKED) And BitAnd(GUICtrlRead($font3),$GUI_CHECKED) Then
GUICtrlSetState($fonts, $GUI_CHECKED)
EndIf
EndSwitch
WEnd
[/au3]
[ 本帖最后由 clonecd 于 2008-8-28 16:06 编辑 ] |
|