hlzxcjx 发表于 2009-11-23 07:30:16

_GUICtrlListViewSort排序时,图标没有跟着排,如何解决?

本帖最后由 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

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
如图:

bing614 发表于 2009-11-23 10:06:48

使用 GUICtrlRegisterListViewSort
http://www.autoitx.com/Doc/source/html/functions/guictrlregisterlistviewsort.htm

hlzxcjx 发表于 2009-11-23 10:32:31

多谢楼上!
页: [1]
查看完整版本: _GUICtrlListViewSort排序时,图标没有跟着排,如何解决?