|
本帖最后由 3131210 于 2017-5-23 15:24 编辑
如何读取数组里面的变量,然后再返回变量值
我有个gui,有控件为下面这样,我想设置数组 $array[] 然后再用GUICtrlRead读取里面的值 但是显示的是0$Ctrlbox0 = GUICtrlCreateCheckbox("Ctrl + 0", 180, 96, 70, 17)
应该怎么改才可以返回控件的值?
$Ctrlbox1 = GUICtrlCreateCheckbox("Ctrl + 1", 180, 120, 70, 17)
GUICtrlSetState(-1, 1)
$Ctrlbox2 = GUICtrlCreateCheckbox("Ctrl + 2", 180, 144, 70, 17)
GUICtrlSetState(-1, 1)
$Ctrlbox3 = GUICtrlCreateCheckbox("Ctrl + 3", 180, 168, 70, 17)
GUICtrlSetState(-1, 1)
$Ctrlbox4 = GUICtrlCreateCheckbox("Ctrl + 4", 180, 192, 70, 17)
GUICtrlSetState(-1, 1)
$Ctrlbox5 = GUICtrlCreateCheckbox("Ctrl + 5", 180, 216, 70, 17)
$Ctrlbox6 = GUICtrlCreateCheckbox("Ctrl + 6", 180, 240, 70, 17)
$Ctrlbox7 = GUICtrlCreateCheckbox("Ctrl + 7", 180, 264, 70, 17)
$Ctrlbox8 = GUICtrlCreateCheckbox("Ctrl + 8", 180, 288, 70, 17)
$Ctrlbox9 = GUICtrlCreateCheckbox("Ctrl + 9", 180, 312, 70, 17)
Local $array = StringSplit("$Ctrlbox0,$Ctrlbox1,$Ctrlbox2,$Ctrlbox3,$Ctrlbox4,$Ctrlbox5,$Ctrlbox6,$Ctrlbox7,$Ctrlbox8,$Ctrlbox9", ",")
For $i = 1 To $array[0]
MsgBox("", "", GUICtrlRead($array[$i]))
Next
|
|