本帖最后由 chzj589 于 2019-7-31 07:07 编辑
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Local $Labela[6]
Local $iNumber = 1
Local $iSpacingX = 200, $iSpacingY = 50
Local $ini = @ScriptDir & "\123.ini"
Local $Form1 = GUICreate("Form1", 500, 340, -1, -1)
Local $Label1 = GUICtrlCreateLabel("↓", 400, 70, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label2 = GUICtrlCreateLabel("↓", 400, 120, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label3 = GUICtrlCreateLabel("↓", 400, 170, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label4 = GUICtrlCreateLabel("↓", 400, 220, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label5 = GUICtrlCreateLabel("↓", 400, 270, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label6 = GUICtrlCreateLabel("↑", 424, 70, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label7 = GUICtrlCreateLabel("↑", 424, 120, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label8 = GUICtrlCreateLabel("↑", 424, 170, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label9 = GUICtrlCreateLabel("↑", 424, 220, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Label10 = GUICtrlCreateLabel("↑", 424, 270, 20, 17)
GUICtrlSetBkColor(-1, 0xfce6c9)
Local $Labela[6]
Local $aArray = IniReadSectionNames($ini)
For $i = 1 To $aArray[0]
$Labela[$i] = GUICtrlCreateLabel($i & " ." & IniRead($ini, $i, "Name", ""), $iSpacingX * Mod($i, $iNumber) + 30, $iSpacingY * Floor($i / $iNumber) + 20, 160, 20)
GUICtrlSetFont(-1, 11, 600, 0, "")
GUICtrlSetColor(-1, 0x0000FF)
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
_Label1()
Case $Label6
_Label()
Case $Label2
_Label2()
EndSwitch
WEnd
Func _Label()
_LabelA()
For $i = 1 To $aArray[0]
$Labela[$i] = GUICtrlCreateLabel($i & " ." & IniRead($ini, $i, "Name", ""), $iSpacingX * Mod($i, $iNumber) + 30, $iSpacingY * Floor($i / $iNumber) + 20, 160, 20)
GUICtrlSetFont(-1, 11, 600, 0, "")
GUICtrlSetColor(-1, 0x0000FF)
Next
EndFunc ;==>_Label
Func _Label1()
_LabelA()
For $i = 1 To $aArray[0] - 1
$Labela[$i] = GUICtrlCreateLabel($i + 1 & " ." & IniRead($ini, $i + 1, "Name", ""), $iSpacingX * Mod($i + 1, $iNumber) + 30, $iSpacingY * Floor($i + 1 / $iNumber) - 30, 160, 20)
GUICtrlSetFont(-1, 11, 600, 0, "")
GUICtrlSetColor(-1, 0x009900)
Next
EndFunc ;==>_Label1
Func _Label2()
_LabelA()
For $i = 1 To $aArray[0] - 2
$Labela[$i] = GUICtrlCreateLabel($i + 2 & " ." & IniRead($ini, $i + 2, "Name", ""), $iSpacingX * Mod($i + 1, $iNumber) + 30, $iSpacingY * Floor($i + 1 / $iNumber) - 30, 160, 20)
GUICtrlSetFont(-1, 11, 600, 0, "")
GUICtrlSetColor(-1, 0x990000)
Next
EndFunc ;==>_Label2
Func _LabelA()
For $i = 0 To $aArray[0]
GUICtrlDelete($Labela[$i]);删除控件
Next
EndFunc ;==>_LabelA
|