#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 805, 305, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
$Button1 = GUICtrlCreateButton("del1", 2, 2, 75, 25)
GUICtrlSetOnEvent(-1, "del1")
$ListView1 = _GUICtrlListView_Create($Form1, "col1|col2|col3", 2, 30, 394, 268)
Dim $aItems[10][3]
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next
_GUICtrlListView_AddArray($ListView1, $aItems)
$Button1 = GUICtrlCreateButton("del2", 400, 2, 75, 25)
GUICtrlSetOnEvent(-1, "del2")
$ListView2 = GUICtrlCreateListView("col1|col2|col3", 402, 30, 394, 268)
For $iI = 0 To 9
GUICtrlCreateListViewItem("Item " & $iI & "|Item " & $iI & "-1|Item " & $iI & "-2", $ListView2)
Next
GUISetState(@SW_SHOW)
While 1
Sleep(10000)
WEnd
Func del1()
MsgBox(0,"","ListView1删除列:"&_GUICtrlListView_DeleteColumn($ListView1,1))
MsgBox(0,"","ListView1删除行:"&_GUICtrlListView_DeleteItem($ListView1,1))
EndFunc ;==>del
Func del2()
MsgBox(0,"","ListView2删除列:"&_GUICtrlListView_DeleteColumn($ListView2,1))
MsgBox(0,"","ListView2删除行:"&_GUICtrlListView_DeleteItem($ListView2,1))
EndFunc ;==>del
Func Close()
Exit
EndFunc ;==>Close
|