复选框问题 请教
#include-once#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
Dim $ary
Opt("GUIOnEventMode", 1)
$GUI = GUICreate("窗口管理器", 300, 150)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "mian")
GUISetOnEvent($GUI_EVENT_RESTORE, "mian")
$checkCN1 = GUICtrlCreateCheckbox ("KCBP窗口", -1, 20, 120, 20)
$checkCN2 = GUICtrlCreateCheckbox ("Tomcat窗口", -1, 40, 120, 20)
$checkCN3 = GUICtrlCreateCheckbox ("Kcxpmanager窗口", -1, 60, 120, 20)
$GUIButton1 = GUICtrlCreateButton ("显示",-1, 100, 50, 20)
$GUIButton2 = GUICtrlCreateButton ( "隐藏",100,100,50, 20)
$GUIButton3 = GUICtrlCreateButton ( "退出",250,130,50, 20)
GUICtrlSetOnEvent($GUIButton1, "Button")
GUICtrlSetOnEvent($GUIButton2, "Button")
GUICtrlSetOnEvent($GUIButton3, "Button")
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
WEnd
Func mian()
Select
Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
Case @GUI_CTRLID = $GUI_EVENT_RESTORE
EndSelect
EndFunc
func Button()
Switch @GUI_CTRLID
Case $GUIButton1
If$ary <> 0 Then
WinSetState ("交易中间件 - KCBP","",@SW_SHOW)
ElseIf $ary <> 0 Then
WinSetState ("Tomcat","",@SW_SHOW)
ElseIf $ary <> 0 Then
WinSetState ("管理器 - [节点名称:Dark] [节点编号:00000001]","",@SW_SHOW)
EndIf
Case $GUIButton2
Select
Case GUICtrlGetState($checkCN1) = $GUI_CHECKED
WinSetState ("交易中间件 - KCBP","",@SW_HIDE)
MsgBox(0,"","$checkCN1")
Case GUICtrlGetState($checkCN2) = $GUI_CHECKED
MsgBox(0,"","$checkCN2")
WinSetState ("交易中间件 - KCBP","",@SW_HIDE)
Case GUICtrlGetState($checkCN3) = $GUI_CHECKED
MsgBox(0,"","$checkCN3")
WinSetState ("KCXP管理器 - [节点名称:Dark] [节点编号:00000001]","",@SW_HIDE)
Case Else
MsgBox(0,"","都没有选中")
ControlDisable ("隐藏","窗口文本",$GUIButton2)
EndSelect
Case $GUIButton3
Exit
EndSwitch
EndFunc
我想实现的效果是:
1.选择其中的1项或3项,单击按钮时,进行隐藏窗口;
2.在没有选择时,置灰按钮;
可现在是,我还没有选择,去单击按钮它会自动选择,复选框。怎么做到我没有选择复选框时,单击按钮时它也不会自动选择复选框。 帮助文件里面有···搜索下·就OK· 本帖最后由 lion.lee 于 2011-6-3 11:05 编辑
1、建议楼主以后发代码用高级模式,别人复制代码方便一点。你说呢?
2、似乎代码不全,没法测试!
3、MsgBox(0, "", "$checkCN1"),只会显示$checkCN1给你,而不是你想要的变量值。显示变量不需要双引号! 回复 3# lion.lee
那只是我测试的时候加上的,不好意思。 第一次发贴,请大家见谅呀。代码错误没有什么关系,关键那种功能。我不知道怎么实现。不懂它们的运行机制 参考这几个函数:
AdlibRegister
guictrlread
guictrlsetstate 谢谢了。大家 回复 3# lion.lee
不用高级也可以吧,那里也有插入代码的按钮哦,然后将'code'改成'au3'就有色了~~
页:
[1]