|
发表于 2015-1-5 16:55:48
|
显示全部楼层
本帖最后由 netegg 于 2015-1-5 17:21 编辑
简单的,后续处理自己琢磨
[au3]#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <GuiEdit.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, $sText, $ret = '', $hEdit
; 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, $x, $image, $image)
Next
_GUICtrlComboBoxEx_SetItemImage($hCombo, 1, 1)
_GUICtrlComboBoxEx_EndUpdate($hCombo)
For $i = 0 To 10
If _GUICtrlComboBoxEx_GetItemImage($hCombo, $i) = 1 Then
_GUICtrlComboBoxEx_GetItemText($hCombo, $i, $sText)
$ret &= $sText & '|'
EndIf
Next
$hEdit = _GUICtrlComboBoxEx_GetEditControl($hCombo)
_GUICtrlEdit_SetText($hEdit, stringtrimright($ret, 1))
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
[/au3] |
|