可能还是卡在获取ID的问题吧~ 呵呵#include <GUIListView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$dir = @ScriptDir & "\Data.ini"
$Form1 = GUICreate("表单", 250, 350, 280, 180)
$ListView1 = GUICtrlCreateListView("姓名 |学历 ", 15, 15, 220, 240, -1, _
BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_REPORT))
$Button1 = GUICtrlCreateButton("读取选中项目", 50, 280, 100, 30, $WS_GROUP)
$Button2 = GUICtrlCreateButton("退出", 180, 280, 50, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
Dim $xusyID[2]
xian()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button2
Exit
Case $Button1
$jg = ''
For $I = 1 To _GUICtrlListView_GetItemCount($ListView1)
If GUICtrlRead($xusyID[$I], 1) = $GUI_CHECKED Then
$jg &= '第 ' & $I & ' 行:"' & _GUICtrlListView_GetItemText($ListView1, $I - 1) & '" 已勾选' & @CRLF
EndIf
Next
MsgBox(0, '勾选的项目', $jg)
EndSwitch
WEnd
Func xian()
$z = 0
_GUICtrlListView_DeleteAllItems($ListView1)
$a = IniReadSectionNames($dir)
If Not @error Then
For $I = 1 To $a[0]
$xusyID[$I] = GUICtrlCreateListViewItem($a[$I], $ListView1)
ReDim $xusyID[$I + 2]
$b = IniRead($dir, $a[$I], "学历", "NotFound")
_GUICtrlListView_AddSubItem($ListView1, $z, $b, 1, 1)
$z += 1
Next
EndIf
EndFunc ;==>xian
|