按条件显示(已解决)
本帖最后由 westmood 于 2015-6-24 13:40 编辑下面这个怎么选择A的时候 AA显示,选择B的时候BB显示,选择C的时候CC显示?#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 637, 259)
$Radio1 = GUICtrlCreateRadio("A", 104, 32, 113, 17)
$Radio2 = GUICtrlCreateRadio("B", 104, 72, 113, 17)
$Radio3 = GUICtrlCreateRadio("C", 104, 112, 113, 17)
$Group1 = GUICtrlCreateGroup("AA", 48, 192, 137, 193)
$Checkbox1 = GUICtrlCreateCheckbox("AAA", 64, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("BB", 208, 192, 137, 193)
$Checkbox2 = GUICtrlCreateCheckbox("BBB", 224, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("CC", 360, 192, 137, 193)
$Checkbox3 = GUICtrlCreateCheckbox("CCC", 376, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
是不是想这样? 我只会笨办法#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 637, 259)
$Radio1 = GUICtrlCreateRadio("A", 104, 32, 113, 17)
$Radio2 = GUICtrlCreateRadio("B", 104, 72, 113, 17)
$Radio3 = GUICtrlCreateRadio("C", 104, 112, 113, 17)
$Group1 = GUICtrlCreateGroup("AA", 48, 192, 137, 193)
$Checkbox1 = GUICtrlCreateCheckbox("AAA", 64, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("BB", 208, 192, 137, 193)
$Checkbox2 = GUICtrlCreateCheckbox("BBB", 224, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("CC", 360, 192, 137, 193)
$Checkbox3 = GUICtrlCreateCheckbox("CCC", 376, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUICtrlSetOnEvent($Radio1, "RadioClick")
GUICtrlSetOnEvent($Radio2, "RadioClick")
GUICtrlSetOnEvent($Radio3, "RadioClick")
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
While 1
Sleep(200)
WEnd
Func Form1Close()
Exit
EndFunc
Func RadioClick()
Select
Case GUICtrlRead($Radio1)=1
GUICtrlSetState($Group1, $GUI_SHOW)
GUICtrlSetState($Checkbox1, $GUI_SHOW)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
Case GUICtrlRead($Radio2)=1
GUICtrlSetState($Group2, $GUI_SHOW)
GUICtrlSetState($Checkbox2, $GUI_SHOW)
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
Case GUICtrlRead($Radio3)=1
GUICtrlSetState($Group3, $GUI_SHOW)
GUICtrlSetState($Checkbox3, $GUI_SHOW)
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
EndSelect
EndFunc
根据2楼的代码,加选中和取消。#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 637, 259)
$Radio1 = GUICtrlCreateRadio("A", 104, 32, 113, 17)
$Radio2 = GUICtrlCreateRadio("B", 104, 72, 113, 17)
$Radio3 = GUICtrlCreateRadio("C", 104, 112, 113, 17)
$Radio4 = GUICtrlCreateRadio("取消", 104, 152, 113, 17)
$Group1 = GUICtrlCreateGroup("AA", 48, 192, 137, 193)
$Checkbox1 = GUICtrlCreateCheckbox("AAA", 64, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("BB", 208, 192, 137, 193)
$Checkbox2 = GUICtrlCreateCheckbox("BBB", 224, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("CC", 360, 192, 137, 193)
$Checkbox3 = GUICtrlCreateCheckbox("CCC", 376, 232, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion ### END Koda GUI section ###
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
While 1
GUISetState(@SW_SHOW)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1
GUICtrlSetState($Group1, $GUI_SHOW)
GUICtrlSetState($Checkbox1, $GUI_SHOW)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
Case $Radio2
GUICtrlSetState($Group2, $GUI_SHOW)
GUICtrlSetState($Checkbox2, $GUI_SHOW)
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
Case $Radio3
GUICtrlSetState($Group3, $GUI_SHOW)
GUICtrlSetState($Checkbox3, $GUI_SHOW)
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
Case $Radio4
GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($Group2, $GUI_HIDE)
GUICtrlSetState($Checkbox2, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
GUICtrlSetState($Checkbox3, $GUI_HIDE)
EndSwitch
WEnd
回复 3# dnvplj
Hi Dnvplj, Problem fixed, thanks. 回复 2# hnfeng
hi Hnfeng,
It's enough for me, thanks for your help!
页:
[1]