本帖最后由 hlzxcjx 于 2009-11-23 10:33 编辑 #include <GuiConstants.au3>
#include <GuiListView.au3>
opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index
GUICreate("ListView Sort", 392, 250)
$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("4.ini|5|more_a", $listview)
GUICtrlSetImage(-1, "shell32.dll", -70)
GUICtrlCreateListViewItem("5.bmp|4.50 |more_c", $listview)
GUICtrlSetImage(-1, "shimgvw.dll", -2)
GUICtrlCreateListViewItem("1.dll|10|more_b", $listview)
GUICtrlSetImage(-1, "shell32.dll", -73)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 200, 70, 30)
GUISetState()
Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ]
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $listview
; sort the list by the column header clicked on
_GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview))
EndSelect
WEnd
Exit
如图:
|