#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $hListView, $but
GUICreate("ListView Set Item Checked State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
; _GUICtrlListView_SetExtendedListViewStyle($hListView, -1)
$but = GUICtrlCreateButton("Submit", 30, 275)
GUISetState()
;新增列
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)
;新增项目
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
While 1
Switch GUIGetMsg()
Case $but
MsgBox(4160, "", "选中了第 "&_GUICtrlListView_GetSelectedIndices($hlistView)&" 行项目。") ;这里启不了作用。
Case -3
Exit
EndSwitch
WEnd
EndFunc ;==>Example
|