#NoTrayIcon
Opt("GUIOnEventMode", 1)
Global $lujin = @ScriptDir
Global $x = 0, $y = 0
Global $shuzu = IniReadSectionNames($lujin & '\顾客.ini')
Local $button[$shuzu[0]]
;~ 读取指定INI中的 所有字段名 并储存在 数组中
$Form1 = GUICreate("顾客", 800, 500, -1, -1)
GUISetOnEvent(-3,"_exit")
For $i = 1 To $shuzu[0]
If IsInt(($i - 1) / 5) Then
$x = $i / 5 * 80
$y = $i
EndIf
$button[$i-1]=GUICtrlCreateButton($shuzu[$i], $x, ($i - $y) * 30)
GUICtrlSetOnEvent(-1,"button_id")
;~ 创建一批按钮 按钮ID储存在 数组中
Next
GUISetState()
While 1
Sleep(100)
WEnd
Func button_id()
$Section=IniReadSection($lujin & '\顾客.ini',GUICtrlRead(@GUI_CtrlId))
Local $temp=""
For $i = 1 To $Section[0][0]
$temp&= $Section[$i][0] & " = " & $Section[$i][1]&@CRLF
Next
MsgBox(0,0,$temp)
EndFunc
Func _exit()
Exit
EndFunc
|