[已解决]下拉框如何执行相应的事件
本帖最后由 xvonline 于 2016-1-13 18:56 编辑#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 483, 374, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 88, 152, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 88, 184, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 88, 216, 97, 17)
$gggg = GUICtrlCreateCombo("勾选部份", 136, 112, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "全部勾选", "勾选部份")
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 48, 112, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
如图 请问 如何实现下拉框的功能,选中【勾选部分】勾选 1 3 号复选框 ,选中【全部勾选】则 复选框 1 2 3 4全部选中。
新手上路 ,搜索了没找到方法,求补全代码。感谢了。 论坛很多源码,请搜索“全选” #include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 483, 374, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 88, 152, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 88, 184, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 88, 216, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 48, 112, 97, 17)
$gggg = GUICtrlCreateCombo("", 166, 112, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($gggg, "全部勾选|勾选部份", "勾选部份")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $gggg
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox4, $GUI_UNCHECKED)
If GUICtrlRead($gggg) = "全部勾选" Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
GUICtrlSetState($Checkbox4, $GUI_CHECKED)
EndIf
If GUICtrlRead($gggg) = "勾选部份" Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
EndIf
EndSwitch
WEnd
小白回答,仅供参考。 回复 2# chamlien
只搜索找到了 复选框 全选/反选 是通过添加一个按钮点击来实现的
我需要的是 选中下拉框中的选项后就直接执行操作
页:
[1]