#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiListView.au3> ;列表
AutoItSetOption("GUIOnEventMode", 1)
; 创建 GUI
GUICreate("添加列表视图子项", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "funcGUISetOnEvent")
$hListView = GUICtrlCreateListView("列1 |列2 |列3 |", 2, 2, 394, 268)
GUICtrlSetBkColor($hListView, 0xffffff) ;设置listview的背景色
GUICtrlSetBkColor($hListView, $GUI_BKCOLOR_LV_ALTERNATE) ;奇数行为listview的背景色,偶数行为listviewitem的背景色
;----------------------使用原生方法插入条目------------------------------------------------------------------
GUICtrlCreateListViewItem("原生插入1-1|是的1-2|是的1-3|", $hListView)
GUICtrlSetBkColor (-1, 0xffa500 );设置listviewitem的背景色
GUICtrlCreateListViewItem("原生插入2-1|是的2-2|是的2-3|", $hListView)
GUICtrlSetBkColor (-1, 0xffa500 )
GUICtrlCreateListViewItem("原生插入3-1|是的3-2|是的3-3|", $hListView)
GUICtrlSetBkColor (-1, 0xffa500 )
GUICtrlCreateListViewItem("原生插入4-1|是的4-2|是的4-3|", $hListView)
GUICtrlSetBkColor (-1, 0xffa500 )
GUICtrlCreateListViewItem("原生插入5-1|是的5-2|是的5-3|", $hListView)
GUICtrlSetBkColor (-1, 0xffa500 )
;--------------------------非原生方法插入条目----------------------------------------------------------------
_GUICtrlListView_InsertItem($hListView, "第一此插入行", 0)
GUICtrlSetBkColor (-1, 0xffa500 );设置listviewitem的背景色
_GUICtrlListView_AddSubItem($hListView, 0, "一2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "一3", 2)
GUICtrlSetBkColor (-1, 0xffa500 )
_GUICtrlListView_InsertItem($hListView, "第二次插入行", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "2-2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "2-3", 2)
GUICtrlSetBkColor (-1, 0xffa500 )
_GUICtrlListView_InsertItem($hListView, "第三次插入", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "三-1", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "三-2", 2)
GUICtrlSetBkColor (-1, 0xffa500 )
_GUICtrlListView_InsertItem($hListView, "第四次插入", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "四-1", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "四-2", 2)
GUICtrlSetBkColor (-1, 0xffa500 )
GUISetState(@SW_SHOW)
While 1
WEnd
Func funcGUISetOnEvent()
Exit
EndFunc