[已解决]GUICtrlCreateCheckbox会出现上次的选择结果,奇怪啊
本帖最后由 chinaxx 于 2011-11-22 14:54 编辑Global $Form1 = GUICreate("系统配置工具", 600, 600, 251, 112)
;GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
;GUISetBkColor (0x0066cc)
GUICtrlCreateGroup("部门选择", 20, 20, 160, 500)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlCreateGroup("软件选择", 220, 20, 360, 500)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $tech =GUICtrlCreateRadio("技术部",30,50,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $wx =GUICtrlCreateRadio("无线部",30,80,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $cw =GUICtrlCreateRadio("财务部",30,110,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi =GUICtrlCreateRadio("商业部",30,140,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUISetState()
While 1
Global $nMsg = GUIGetMsg()
Global $Info = GUIGetCursorInfo()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $tech
;MsgBox(0,"a","aaaa")
;GUICtrlCreateLabel("",225,45,350,450)
Global $tech1=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $tech2=GUICtrlCreateCheckbox("Mindmanger", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $tech3=GUICtrlCreateCheckbox("Google Chrome", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
;ExitLoop
Case $wx
GUICtrlCreateLabel("",225,45,350,450)
GUICtrlCreateGroup("软件选择", 220, 20, 360, 500)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $wx1=GUICtrlCreateCheckbox("Microsoft Office Project", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $wx2=GUICtrlCreateCheckbox("Eclipse", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $wx3=GUICtrlCreateCheckbox("SecureCRT", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Case $cw
;GUICtrlDelete($tech1)
;GUICtrlDelete($tech2)
;GUICtrlCreateLabel("",225,45,350,450)
Global $cw1=GUICtrlCreateCheckbox("Microsoft Office Project", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $cw2=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $cw3=GUICtrlCreateCheckbox("Photoshop", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $cw4=GUICtrlCreateCheckbox("PDF Converter", 230, 140, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Case $bi
;GUICtrlCreateLabel("",225,45,350,450)
Global $bi1=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi2=GUICtrlCreateCheckbox("SecureCRT", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi3=GUICtrlCreateCheckbox("Sybase PowerDesigner", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi4=GUICtrlCreateCheckbox("UltraEdit", 230, 140, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi5=GUICtrlCreateCheckbox("SPSS Clementine", 230, 170, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi6=GUICtrlCreateCheckbox("Mindmanager", 230, 200, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
EndSwitch
WEnd当运行后,选择 其中一个 Radio后,在后面的checkbox中选择任何一个后,再选择 另一个radio后,当鼠标移动后面的checkbox时,就会显示上一个radio的结果,我可能说的不清楚,但只要运行一下代码就知道问题了,那位高手帮忙解决一下,谢谢啊 实际上应该是没有选中的,只不过是位置相同当鼠标移上去是原来 的又覆盖回来的原因.在点击radio时更新一下checkbox
纯菜鸟见解.{:face (411):} 当你最小化后再打开,原来选择中的checkbox又重新便空,鼠标移上后又显示出来...哈哈 回复 1# chinaxx
改好了,你试试看#include <GUIConstantsEx.au3>
Dim $checkbox
Global $Form1 = GUICreate("系统配置工具", 600, 600, 251, 112)
;GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
;GUISetBkColor (0x0066cc)
GUICtrlCreateGroup("部门选择", 20, 20, 160, 500)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlCreateGroup("软件选择", 220, 20, 360, 500)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $tech =GUICtrlCreateRadio("技术部",30,50,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $wx =GUICtrlCreateRadio("无线部",30,80,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $cw =GUICtrlCreateRadio("财务部",30,110,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Global $bi =GUICtrlCreateRadio("商业部",30,140,121,33)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
;GUICtrlCreateLabel("",225,45,350,450)
;GUICtrlCreateGroup("软件选择", 220, 20, 360, 500)
;GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUISetState()
While 1
Global $nMsg = GUIGetMsg()
Global $Info = GUIGetCursorInfo()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $tech
For $i = 0 To 5
GUICtrlDelete($checkbox[$i])
Next
$checkbox=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Mindmanger", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Google Chrome", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("", 230, 140, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
$checkbox=GUICtrlCreateCheckbox("", 230, 170, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
$checkbox=GUICtrlCreateCheckbox("", 230, 200, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
Case $wx
For $i = 0 To 5
GUICtrlDelete($checkbox[$i])
Next
$checkbox=GUICtrlCreateCheckbox("Microsoft Office Project", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Eclipse", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("SecureCRT", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("", 230, 140, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
$checkbox=GUICtrlCreateCheckbox("", 230, 170, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
$checkbox=GUICtrlCreateCheckbox("", 230, 200, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
Case $cw
For $i = 0 To 5
GUICtrlDelete($checkbox[$i])
Next
$checkbox=GUICtrlCreateCheckbox("Microsoft Office Project", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Photoshop", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("PDF Converter", 230, 140, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_show)
$checkbox=GUICtrlCreateCheckbox("", 230, 170, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
$checkbox=GUICtrlCreateCheckbox("", 230, 200, 220, 20)
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_HIDE)
Case $bi
For $i = 0 To 5
GUICtrlDelete($checkbox[$i])
Next
$checkbox=GUICtrlCreateCheckbox("Microsoft Office Visio", 230, 50, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("SecureCRT", 230, 80, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("Sybase PowerDesigner", 230, 110, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
$checkbox=GUICtrlCreateCheckbox("UltraEdit", 230, 140, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_show)
$checkbox=GUICtrlCreateCheckbox("SPSS Clementine", 230, 170, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_show)
$checkbox=GUICtrlCreateCheckbox("Mindmanager", 230, 200, 220, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetState(-1,$GUI_unchecked)
GUICtrlSetState(-1,$GUI_show)
EndSwitch
WEnd 谢谢,果然可以了,后来我也试了另一种方法,就是把之前 全部删除。 个人觉得这样的方式不太可取,用显示、隐藏控件的方式可能会更适合。 感谢,感谢,学习了,学习了。非常感谢
页:
[1]