本帖最后由 夜猫猫 于 2011-7-7 10:18 编辑
有点头目了...
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;Opt("GUIOnEventMode", 1)
Global $button[5]=[1,2,3,4,5]
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124, $WS_POPUP)
$Edit1 = GUICtrlCreateEdit("", 232, 48, 321, 305)
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\规格.ini"))
$Button01= GUICtrlCreateButton("退出", 500, 400, 97, 33)
GUICtrlSetOnEvent(-1, "_Exit")
$Cfg = @ScriptDir &"\config.ini"
$Hei = 40
$Car = IniReadSection($Cfg, "分类")
For $i = 1 To $Car[0][0]
;Msgbox ("","",$Car[$i][1])
$button[$i]= GUICtrlCreateButton($Car[$i][1], 24, $Hei, 97, 33)
$Hei = $Hei +45
Next
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button[1]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\规格.ini"))
Case $button[2]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\价格.ini"))
Case $Button[3]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\数量.ini"))
Case $Button01
_Exit()
EndSwitch
WEnd
Func _Exit()
Exit
EndFunc
需要简化.
Case $Button[1]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\规格.ini"))
Case $button[2]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\价格.ini"))
Case $Button[3]
GUICtrlSetData($Edit1, FileRead(@ScriptDir&"\数量.ini")) |