本帖最后由 fenhanxue 于 2017-8-23 21:08 编辑 #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
$Form1 = GUICreate("Form1", 506, 405, 192, 114)
$ListView1 = GUICtrlCreateListView("测试", 8, 24, 473, 209)
$Button1 = GUICtrlCreateButton("GUICtrlCreateListViewItem",24, 264, 169, 41 )
$Button2 = GUICtrlCreateButton("_GUICtrlListView_AddItem", 272, 264, 161, 41 )
$Button3 = GUICtrlCreateButton("删除第三行",104, 352, 281, 41)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
For $i = 1 To 5
GUICtrlCreateListViewItem($i,$ListView1)
Next
Case $Button2
For $i = 1 To 5
_GUICtrlListView_AddItem($ListView1,$i)
Next
Case $Button3
_GUICtrlListView_DeleteItem($ListView1,2)
EndSwitch
WEnd
listview的项目,用 GUICtrlCreateListViewItem 创建,可以_GUICtrlListView_DeleteItem正常删除
用 _GUICtrlListView_AddItem创建的,无法_GUICtrlListView_DeleteItem删除
au3版本:3.3.9.21 |