在GUI上创建一个 ListView 项目控件。
GUICtrlCreateListViewItem ( "文本", listviewID )
参数
| 文本 | 由竖线 | 分开的子项目文本。 |
| listviewID | (此控件)所属 ListView 控件的ID。 |
返回值
| 成功: | 返回控件标识符(控件ID)。 |
| 失败: | 返回值为0。 |
注意
本函数用于创建 ListView 项目,创建的项目和普通的控件一样可以使用 GUICtrlSetData 设置相关数据。
相关
GUICtrlCreateListView, GUICtrlSetData, GUICtrlSetState, GUICtrlDelete, GUIGetMsg, GUICtrlRead
示例
#include <GUIConstants.au3>
GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF) ; 更改背景颜色
$listview = GuiCtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GuiCtrlCreateButton ("Value?",75,170,70,20)
$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_ACCEPTFILES) ; 允许拖放
GuiSetState()
GUICtrlSetData($item2,"|ITEM1",)
GUICtrlSetData($item3,"||COL33",)
GUICtrlDelete($item1)
Do
$msg = GuiGetMsg ()
Select
Case $msg = $button
MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
Case $msg = $listview
MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE