回复 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
|