Sign in to follow this  
Followers 0
muncherw

Color list items in combobox

5 posts in this topic

I'd like some items in a combo box to have a slightly different background color from each other. I know this can't be done with any normal means but I saw someone do this with  3 or 4 weeks ago with listview items (I can't find the thread now though) and wondered if anyone had tried something similar for combobox items.  Not to be confused with alternating list items.


Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]

Share this post


Link to post
Share on other sites



muncherw,

The listview colouring UDF is here. I have not seen anything about colouring combos, sorry.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

muncherw,

The listview colouring UDF is here.  I have not seen anything about colouring combos, sorry.

M23

Thanks, Melba23. 


Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]

Share this post


Link to post
Share on other sites

Not exactly, but maybe it helps.

br, Reinhard

;; example written from ProgAndy

#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

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hImage, $hCombo,$bmp

; Create GUI

$hGUI = GUICreate("ComboBoxEx Set Image List", 400, 300)

$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)

$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)

GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

GUISetState()

$hImage = _GUIImageList_Create (20, 12, 5, 3)

Local $List[7][2] = [ _

["ROT",0xFF0000] , _

["Grün",0x00FF00] , _

["Blau",0x0000FF] , _

["Gelb",0xFFFF00] , _

["cyan",0x00FFFF] , _

["Weiß",0xFFFFFF] , _

["Schwarz",0x000000] ]

;Set Image List

_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

; Add Items

For $i = 0 To UBound($List)-1

$bmp = _IMGListAddColor($hImage,$List[$i][1],20,12)

_GUICtrlComboBoxEx_AddString ($hCombo, $List[$i][0], $bmp, $bmp)

Next

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Prog@ndy

Func _IMGListAddColor($hImage,$Color,$W=16,$H=16)

Local $bmp = _WinAPI_CreateSolidBitMap (_WinAPI_GetDesktopWindow(), $Color,$W,$H)

Local $index = _GUIImageList_Add ($hImage,$bmp)

_WinAPI_DeleteObject($bmp)

Return $index

EndFunc

Share this post


Link to post
Share on other sites

Not exactly, but maybe it helps.

br, Reinhard

Won't look like what I had envisioned but may serve  the purpose just as well. Thanks. :)


Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0