找回密码
 加入
搜索
查看: 2190|回复: 0

[GUI管理] ListView图标更换问题【已解决】

[复制链接]
发表于 2011-8-5 20:27:01 | 显示全部楼层 |阅读模式
本帖最后由 sliqi 于 2011-8-7 00:51 编辑

例;在listview里有5行数据    按下butonn搜索12,然后修改这行的图标,请大侠赐教
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global $from1,$ListView1
$Form1 = GUICreate("我的列表", 360, 320)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
$ListView1 = GUICtrlCreateListView("列a|列b|列c|列d|列e", 8, 8, 361, 150)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

$Button_1 = GUICtrlCreateButton("修改12的图标", 10, 180)
$Button_2 = GUICtrlCreateButton("修改14的图标", 10, 230)


  
for $i = 1 to 5
GUICtrlCreateListViewItem($i&"|1"&$i&"|2"&$i&"|3"&$i&"|4"&$i,$ListView1)
GUICtrlSetImage(-1, "shell32.dll", 18)
Next


GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
   Case $GUI_EVENT_CLOSE
    Exit
        
Case $Button_1
        $con= CONTROLLISTVIEW($from1 , "" , $ListView1, "FindItem" , "12", 1)
        
If $con <> -1 Then
;;这里设置listviewitem图标
;;;


EndIf

EndSwitch
WEnd
发表于 2011-8-5 20:55:36 | 显示全部楼层

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global $from1, $ListView1
$Form1 = GUICreate("我的列表", 360, 320)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
$ListView1 = GUICtrlCreateListView("列a|列b|列c|列d|列e", 8, 8, 361, 150)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

$Button_1 = GUICtrlCreateButton("修改12的图标", 10, 180)
$Button_2 = GUICtrlCreateButton("修改14的图标", 10, 230)

Dim $list[5]

For $i = 0 To 4
        $list[$i] = GUICtrlCreateListViewItem($i & "|1" & $i & "|2" & $i & "|3" & $i & "|4" & $i, $ListView1)
        GUICtrlSetImage(-1, "shell32.dll", 18)
Next


GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button_1
                        $con = ControlListView($from1, "", $ListView1, "FindItem", "12", 1)

                        If $con <> -1 Then
                                ;;这里设置listviewitem图标
                                ;;;
                                GUICtrlSetImage($list[$con], "shell32.dll", 12)

                        EndIf

        EndSwitch
WEnd

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-13 23:54 , Processed in 0.072097 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表