找回密码
 加入
搜索
查看: 3706|回复: 4

[GUI管理] 按条件显示(已解决)

[复制链接]
发表于 2015-6-24 09:22:04 | 显示全部楼层 |阅读模式
本帖最后由 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
发表于 2015-6-24 12:05:41 | 显示全部楼层
是不是想这样?   我只会笨办法
#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 
发表于 2015-6-24 13:29:50 | 显示全部楼层
根据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
 楼主| 发表于 2015-6-24 13:38:35 | 显示全部楼层
回复 3# dnvplj


    Hi Dnvplj, Problem fixed, thanks.
 楼主| 发表于 2015-6-24 13:39:25 | 显示全部楼层
回复 2# hnfeng


    hi Hnfeng,

It's enough for me, thanks for your help!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-16 18:32 , Processed in 0.078068 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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