看了看代码,是这个意思,但是我无法确定我到底创建了多少个控件,您的例子与我主题中发的地址例子是一样的。
所以我还是想通过上面_GUICtrlListView_SetItemImage的方式来实现 回复 12# afan
能不能只换一行!!这样所有listview列表框的图标都设置没了,搞笑了,而且用_GUIImageList_AddIcon添加的图像列表,图标背景成黑色了!
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <GuiImageList.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 496, 389, 270, 202)
$ListView1 = GUICtrlCreateListView("col1|col2|col3", 16, 16, 466, 302)
$ListViewButton = GUICtrlCreateContextMenu($ListView1)
$ListBut_1 = GUICtrlCreateMenuItem("换图标", $ListViewButton)
$ListBut_2 = GUICtrlCreateMenuItem("Eixt", $ListViewButton)
$Button1 = GUICtrlCreateButton("Button1", 328, 336, 75, 25)
$Button2 = GUICtrlCreateButton("Exit", 408, 336, 75, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
For $i = 1 To 10
GUICtrlCreateListViewItem('1 - ' & $i & '|2 - ' & $i & '|3 - ' & $i, $ListView1)
GUICtrlSetImage(-1, @SystemDir & '\shell32.dll', -28)
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $ListBut_2, $Button2
Exit
Case $ListBut_1
SetImage()
EndSwitch
WEnd
Func SetImage()
$hImage = _GUIImageList_Create()
_GUIImageList_AddIcon($hImage, @SystemDir & '\shell32.dll', -25)
_GUICtrlListView_SetImageList($ListView1, $hImage, 1)
_GUICtrlListView_SetItemImage($ListView1, 1, 3);换第三行
EndFunc
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 496, 389, 270, 202)
$ListView1 = GUICtrlCreateListView("col1|col2|col3", 16, 16, 466, 302)
$ListViewButton = GUICtrlCreateContextMenu($ListView1)
$ListBut_1 = GUICtrlCreateMenuItem("换图标", $ListViewButton)
$ListBut_2 = GUICtrlCreateMenuItem("Eixt", $ListViewButton)
$Button1 = GUICtrlCreateButton("Button1", 328, 336, 75, 25)
$Button2 = GUICtrlCreateButton("Exit", 408, 336, 75, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
For $i = 1 To 10
ConsoleWrite(GUICtrlCreateListViewItem('1 - ' & $i & '|2 - ' & $i & '|3 - ' & $i, $ListView1)&@CRLF)
GUICtrlSetImage(-1, @SystemDir & '\shell32.dll', -25)
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $ListBut_2, $Button2
Exit
Case $ListBut_1
GUICtrlSetImage(GUICtrlRead($ListView1), @SystemDir & '\shell32.dll', -20)
EndSwitch
WEnd最简单的解决方案 回复 18# 298311657
GUICtrlRead($ListView1),没想到,学习了!! 回复 17# nmgwddj
既然是 GUICtrlCreateListViewItem() 创建的 Item,用 298311657 写的的设置 Id 图标的方式足矣 我靠!!!竟然如此简单!!给力给力中。 回复 20# afan
A版您指的 298311657 是什么意思? 回复afan
A版您指的 298311657 是什么意思?
nmgwddj 发表于 2012-2-19 22:22 http://www.autoitx.com/images/common/back.gif
18#的大虾~ 谢谢楼主共享好源码
页:
1
[2]