你可以去参考一下#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
Opt('MustDeclareVars', 1)
$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work
_Main()
Func _Main()
Local $hGUI, $hImage, $image, $hCombo
; Create GUI
$hGUI = GUICreate("ComboBoxEx Get/Set Item Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()
$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\rasdlg.dll", 1)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\rasdlg.dll", 0)
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 10
$image = Random(0, 1, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 10, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 1, 1)
MsgBox(4160, "Information", "Item Image: " & _GUICtrlComboBoxEx_GetItemImage ($hCombo, 0))
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
|