回复 1# pc961913
#include <GUIConstantsEx.au3>
Opt('GUIOnEventMode', 1)
$INIFile = "chengji.ini"
Global $Values = IniReadSection($INIFile, "CJ")
Global $MK_Count = $Values[0][0]
GUICreate("成绩",200,500) ;
GUISetOnEvent(-3,"_displayScore")
Opt("GUICoordMode", 2)
;Const $N = 11
Global $button[$MK_Count+1]
$button_1 = GUICtrlCreateButton("以下是学生列表", 25, 30,150,50)
GUICtrlSetState($button_1, $GUI_DISABLE)
For $Index = 1 To $MK_Count
$button[$Index] = GUICtrlCreateButton($Values[$Index][0], -1,0)
GUICtrlSetFont(-1,18,400,"Arial")
GUICtrlSetOnEvent(-1,"_displayScore")
Next
GUISetState(@SW_SHOW)
While 1
Sleep(2000)
WEnd
Func _displayScore()
For $i = 1 To $MK_Count
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
exit
Case $button[$i]
MsgBox(0,"成绩报告",'姓名:'& $Values[$i][0] & @CRLF & '成绩:' & $Values[$i][1] & @CRLF & '等级:' & _JudgeScore($Values[$i][1]))
EndSwitch
Next
EndFunc
Func _JudgeScore($iScore)
If $iScore < 60 Then
Return "不及格"
ElseIf $iScore < 80 Then
Return "及格"
ElseIf $iScore < 90 Then
Return "良好"
Else
Return "优秀"
EndIf
EndFunc
|