#include <GUIConstants.au3>
Global $Row = 8, $Col = 3, $a[$Row], $b[$Row], $c[$Row], $d[$Row], $e[$Row], $f[$Row], $ButtonArray[$Row][$Col]
$MyForm = GUICreate('', 400, 350)
For $i = 0 To $Row - 1
$a[$i] = GUICtrlCreateButton('A - ' & $i + 1, 10, 45 + $i * 24, 40, 22)
$ButtonArray[$i][0] = $a[$i]
$d[$i] = GUICtrlCreateButton(Random(1, 1000, 1), 60, 45 + $i * 24, 40, 22) ;扰乱
$b[$i] = GUICtrlCreateButton('B - ' & $i + 1, 110, 45 + $i * 24, 40, 22)
$ButtonArray[$i][1] = $b[$i]
$e[$i] = GUICtrlCreateButton(Random(1, 1000, 1), 160, 45 + $i * 24, 40, 22) ;扰乱
$c[$i] = GUICtrlCreateButton('C - ' & $i + 1, 210, 45 + $i * 24, 40, 22)
$ButtonArray[$i][2] = $c[$i]
$f[$i] = GUICtrlCreateButton(Random(1, 1000, 1), 260, 45 + $i * 24, 40, 22) ;扰乱
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonArray[0][0] To $ButtonArray[$Row - 1][$Col - 1]
ArraySearch($nMsg)
EndSwitch
WEnd
Func ArraySearch($nMsg)
For $i = 0 To $Row - 1
For $j = 0 To $Col - 1
If $ButtonArray[$i][$j] = $nMsg Then
ButtonArrayBase($i, $j)
EndIf
Next
Next
EndFunc ;==>ArraySearch
Func ButtonArrayBase($Row, $Col)
Switch $Col
Case 0 ;A列
MsgBox('控件ID:' & $ButtonArray[$Row][$Col], 0, '第六列数字为:' & GUICtrlRead($ButtonArray[$Row][$Col] + 5))
Case 1 ;B列
MsgBox('控件ID:' & $ButtonArray[$Row][$Col], 0, '第四列数字为:' & GUICtrlRead($ButtonArray[$Row][$Col] + 1))
Case 2 ;C列
MsgBox('控件ID:' & $ButtonArray[$Row][$Col], 0, '第二列数字为:' & GUICtrlRead($ButtonArray[$Row][$Col] - 3))
EndSwitch
EndFunc ;==>ButtonArrayBase