二楼正解,试着自己添加到楼主的代码上实现了效果
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <GuiListView.au3>
$Form1 = GUICreate("Form1", 350, 250)
$ListView1 = GUICtrlCreateListView("", 16, 8, 305, 130, _
BitOR($GUI_SS_DEFAULT_LISTVIEW, $WS_BORDER), _
BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))
$Button1 = GUICtrlCreateButton("开始", 104, 208, 97, 25)
GUISetState(@SW_SHOW)
_GUICtrlListView_RegisterSortCallBack($ListView1)
_GUICtrlListView_AddColumn($ListView1, '', 22, 2)
_GUICtrlListView_AddColumn($ListView1, 'aaa', 60, 0)
_GUICtrlListView_AddColumn($ListView1, 'bbb', 40, 0)
_GUICtrlListView_AddColumn($ListView1, 'ccc', 40, 2)
_GUICtrlListView_AddColumn($ListView1, 'ddd', 40, 2)
_GUICtrlListView_AddColumn($ListView1, 'eee', 40, 2)
Dim $a_FromIni[11][2] = [[10, ""], _
["a", "abffbdf0001|123|0|0"], _
["a", "abffbdf0002|123|0|0"], _
["a", "abffbdf0003|123|0|0"], _
["a", "abffbdf0004|123|0|0"], _
["a", "abffbdf0005|123|0|0"], _
["a", "abffbdf0006|123|0|0"], _
["a", "abffbdf0007|123|0|0"], _
["a", "abffbdf0008|123|0|0"], _
["a", "abffbdf0009|123|0|0"], _
["a", "abffbdf0010|123|0|0"]]
Dim $item[1], $i
For $i = 1 To $a_FromIni[0][0]
$item[$i - 1] = GUICtrlCreateListViewItem("" & '|' & $a_FromIni[$i][1], $ListView1)
ReDim $item[$i + 1]
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
_Main()
Case $ListView1
_GUICtrlListView_SortItems($ListView1, GUICtrlGetState($ListView1))
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Main()
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
Sleep(300)
_GUICtrlListView_SetItemSelected($ListView1, $i) ; 为了指示正在处理的行
_GUICtrlListView_EnsureVisible($ListView1, $i)
If _GUICtrlListView_GetItemText($ListView1, $i, 5) = "" Then
_GUICtrlListView_SetItemText($ListView1, $i, "xx", 5)
Else
_GUICtrlListView_SetItemText($ListView1, $i, "", 5)
EndIf
Next
EndFunc ;==>_Main
|