Jump to content

Fancy and better looking ComboBox ?


 Share

Recommended Posts

  • Moderators

Juvigy,

You can colour the input section of a combo by removing the theme:

#include <GUIConstantsEx.au3>

$sData = "1|2|3|4|5"

$hGUI = GUICreate("Test", 500, 500)

$hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20)
GUICtrlSetData($hCombo, $sData)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hCombo), "wstr", 0, "wstr", 0)
GUICtrlSetBkColor($hCombo, 0xFFCCCC)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

But that is as far as I can go - sorry. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

GUICtrlCreateCombo doesnt look nice at all and i cant find any way to set bg color etc.

Is there a custom UDF that someone made that has better combobox controls ?

Define "better" combobox controls...

What feature(s) or look are you after?

Link to comment
Share on other sites

10x for the replies guys.

@Melba - your code didnt work as expected for me - i got a normal combobox - maybe the DLL call didnt work as expected

@ResNullius - i would like to be able to change the background color and the text color of the combo. It would also be "nice to have" not rectangle shaped combo , but ellipse or ellipse + rectangle shaped combos.

Link to comment
Share on other sites

@ResNullius - i would like to be able to change the background color and the text color of the combo. It would also be "nice to have" not rectangle shaped combo , but ellipse or ellipse + rectangle shaped combos.

Authenticity did an example of coloured text in a combo here: #717985

Might be something to get you started...

Link to comment
Share on other sites

Nice example. Thou i didnt manage to set the combobox background. Just managed to color the bgnd of the selectable text of the combobox.

@ Authenticity - Can you please help about that?

#include <GUIComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global Const $ODT_MENU          = 1
Global Const $ODT_LISTBOX       = 2
Global Const $ODT_COMBOBOX      = 3
Global Const $ODT_BUTTON        = 4
Global Const $ODT_STATIC        = 5
Global Const $ODT_HEADER        = 100
Global Const $ODT_TAB           = 101
Global Const $ODT_LISTVIEW      = 102

Global Const $ODA_DRAWENTIRE    = 1
Global Const $ODA_SELECT        = 2
Global Const $ODA_FOCUS         = 4
Global Const $ODS_SELECTED      = 1
Global Const $ODS_GRAYED        = 2
Global Const $ODS_DISABLED      = 4
Global Const $ODS_CHECKED       = 8
Global Const $ODS_FOCUS         = 16
Global Const $ODS_DEFAULT       = 32
Global Const $ODS_HOTLIGHT      = 64
Global Const $ODS_INACTIVE      = 128
Global Const $ODS_NOACCEL       = 256
Global Const $ODS_NOFOCUSRECT   = 512
Global Const $ODS_COMBOBOXEDIT  = 4096

Global Const $clrWindowText     = _WinAPI_GetSysColor($COLOR_WINDOWTEXT)
Global Const $clrHighlightText  = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT)
Global Const $clrHightlight     = _WinAPI_GetSysColor($COLOR_HIGHLIGHT)
Global Const $clrWindow         = _WinAPI_GetSysColor($COLOR_WINDOW)

Global Const $tagDRAWITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemAction;' & _
    'uint itemState;' & _
    'hwnd hwndItem;' & _
    'hwnd hDC;' & _
    $tagRECT & _
    ';ulong_ptr itemData;'
    
Global Const $tagMEASUREITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemWidth;' & _
    'uint itemHeight;' & _
    'ulong_ptr itemData;'


Global $hGUI
Global $ComboBox
Global $sStr = ''

GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM')
GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM')

$hGUI = GUICreate('Test', 200, 200)
$ComboBox = GUICtrlCreateCombo('', 0, 0, 200, 200, BitOR($WS_CHILD, $CBS_OWNERDRAWFIXED, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST))
GUICtrlSetFont($ComboBox, 14, 800)

For $i = 1 To 20
    $sStr &= 'String ' & $i & '|'
Next

GUICtrlSetData($ComboBox, StringTrimRight($sStr, 1))
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
Exit

Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tMIS = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemWidth, $iItemHeight
    Local $hComboBox
    Local $tSize
    Local $hDC
    
    $iCtlType    = DllStructGetData($tMIS, 'CtlType')
    $iCtlID      = DllStructGetData($tMIS, 'CtlID')
    $iItemID     = DllStructGetData($tMIS, 'itemID')
    $iItemWidth  = DllStructGetData($tMIS, 'itemWidth')
    $iItemHeight = DllStructGetData($tMIS, 'itemHeight')
    $hComboBox   = GUICtrlGetHandle($iCtlID)
    
    If $iCtlType = $ODT_COMBOBOX Then
        $hDC = _WinAPI_GetDC($hComboBox)
        $tSize = _WinAPI_GetTextExtentPoint32($hDC, 'S')
        DllStructSetData($tMIS, 'itemHeight', DllStructGetData($tSize, 'Y')+8)
    EndIf
    
    Return $GUI_RUNDEFMSG
EndFunc


Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState
    Local $clrForeground, $clrBackground
    Local $hWndItem, $hDC
    Local $tRect
    Local $sText
    
    $iCtlType    = DllStructGetData($tDIS, 'CtlType')
    $iCtlID      = DllStructGetData($tDIS, 'CtlID')
    $iItemID     = DllStructGetData($tDIS, 'itemID')
    $iItemAction = DllStructGetData($tDIS, 'itemAction')
    $iItemState  = DllStructGetData($tDIS, 'itemState')
    $hWndItem    = DllStructGetData($tDIS, 'hwndItem')
    $hDC         = DllStructGetData($tDIS, 'hDC')
    $tRect       = DllStructCreate($tagRECT)

    If $iCtlType = $ODT_COMBOBOX And $iCtlID = $ComboBox Then
        Switch $iItemAction
            Case $ODA_DRAWENTIRE
                For $i = 1 To 4
                    DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7))
                Next
                
                _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText)
                
                $clrForeground = _WinAPI_SetTextColor($hDC, 0xFF)
                If BitAND($iItemState, $ODS_SELECTED) Then
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight)
                Else
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow)
                EndIf
                
                _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT)
                _WinAPI_SetTextColor($hDC, $clrForeground)
                _WinAPI_SetBkColor($hDC, $clrBackground)
                
            Case $ODA_SELECT
                For $i = 1 To 4
                    DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7))
                Next
                
                _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText)
                
                $clrForeground = _WinAPI_SetTextColor($hDC, 0xFF)
                If BitAND($iItemState, $ODS_SELECTED) Then
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight)
                Else
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow)
                EndIf
                
                _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT)
                _WinAPI_SetTextColor($hDC, $clrForeground)
                _WinAPI_SetBkColor($hDC, $clrBackground)
                
        EndSwitch
    EndIf
    
    Return $GUI_RUNDEFMSG
EndFunc

@Edit

Here is a preview of what i want. Something similar to the third column:

http://www.lisisoft.com/imglisi/7/VisualBasic/7007clrsnap.gif

Edited by Juvigy
Link to comment
Share on other sites

#include <GUIComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global Const $ODT_MENU          = 1
Global Const $ODT_LISTBOX       = 2
Global Const $ODT_COMBOBOX      = 3
Global Const $ODT_BUTTON        = 4
Global Const $ODT_STATIC        = 5
Global Const $ODT_HEADER        = 100
Global Const $ODT_TAB           = 101
Global Const $ODT_LISTVIEW      = 102

Global Const $ODA_DRAWENTIRE    = 1
Global Const $ODA_SELECT        = 2
Global Const $ODA_FOCUS         = 4

Global Const $ODS_SELECTED      = 1
Global Const $ODS_GRAYED        = 2
Global Const $ODS_DISABLED      = 4
Global Const $ODS_CHECKED       = 8
Global Const $ODS_FOCUS         = 16
Global Const $ODS_DEFAULT       = 32
Global Const $ODS_HOTLIGHT      = 64
Global Const $ODS_INACTIVE      = 128
Global Const $ODS_NOACCEL       = 256
Global Const $ODS_NOFOCUSRECT   = 512
Global Const $ODS_COMBOBOXEDIT  = 4096

Global Const $clrWindowText     = _WinAPI_GetSysColor($COLOR_WINDOWTEXT)
Global Const $clrHighlightText  = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT)
;~ Global Const $clrHightlight     = _WinAPI_GetSysColor($COLOR_HIGHLIGHT)
;~ Global Const $clrWindow         = _WinAPI_GetSysColor($COLOR_WINDOW)
Global Const $clrHighlight      = 0x9CBDAD
Global Const $clrWindow         = 0xE7CEBD

Global Const $tagDRAWITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemAction;' & _
    'uint itemState;' & _
    'hwnd hwndItem;' & _
    'hwnd hDC;' & _
    $tagRECT & _
    ';ulong_ptr itemData;'

Global Const $tagMEASUREITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemWidth;' & _
    'uint itemHeight;' & _
    'ulong_ptr itemData;'


Global $hGUI
Global $ComboBox
Global $hBrushNorm = _WinAPI_CreateSolidBrush($clrWindow)
Global $hBrushSel  = _WinAPI_CreateSolidBrush($clrHighlight)
Global $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFFFFFF)

GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM')
GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM')

$hGUI = GUICreate('Test', 220, 300)
$ComboBox = GUICtrlCreateCombo('', 10, 10, 200, 300, BitOR($WS_CHILD, $CBS_OWNERDRAWVARIABLE, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST))
GUICtrlSetData($ComboBox, "Apple|Banana|Orange|Pear|Plum|Watermelon")

GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_WinAPI_DeleteObject($hPen)
_WinAPI_DeleteObject($hBrushSel)
_WinAPI_DeleteObject($hBrushNorm)
GUIDelete()

Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tMIS = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemWidth, $iItemHeight
    Local $hComboBox
    Local $tSize
    Local $sText

    $iCtlType    = DllStructGetData($tMIS, 'CtlType')
    $iCtlID      = DllStructGetData($tMIS, 'CtlID')
    $iItemID     = DllStructGetData($tMIS, 'itemID')
    $iItemWidth  = DllStructGetData($tMIS, 'itemWidth')
    $iItemHeight = DllStructGetData($tMIS, 'itemHeight')
    $hComboBox   = GUICtrlGetHandle($iCtlID)

    If $iCtlType = $ODT_COMBOBOX Then DllStructSetData($tMIS, 'itemHeight', 20)

    Return $GUI_RUNDEFMSG
EndFunc

Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState
    Local $clrForeground, $clrBackground
    Local $hWndItem, $hDC, $hOldPen, $hOldBrush
    Local $tRect, $aRect[4]
    Local $sText

    $iCtlType    = DllStructGetData($tDIS, 'CtlType')
    $iCtlID      = DllStructGetData($tDIS, 'CtlID')
    $iItemID     = DllStructGetData($tDIS, 'itemID')
    $iItemAction = DllStructGetData($tDIS, 'itemAction')
    $iItemState  = DllStructGetData($tDIS, 'itemState')
    $hWndItem    = DllStructGetData($tDIS, 'hwndItem')
    $hDC         = DllStructGetData($tDIS, 'hDC')
    $tRect       = DllStructCreate($tagRECT)

    If $iCtlType = $ODT_COMBOBOX Then
        Switch $iCtlID
            Case $ComboBox
                For $i = 1 To 4
                    DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7))
                    $aRect[$i-1] = DllStructGetData($tRect, $i)
                Next

                _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText)

                If BitAND($iItemState, $ODS_SELECTED) Then
                    $hOldBrush = _WinAPI_SelectObject($hDC, $hBrushSel)
                    $hOldPen = _WinAPI_SelectObject($hDC, $hPen)
                    _WinAPI_Rectangle($hDC, $aRect[0]+1, $aRect[1]+1, $aRect[2], $aRect[3])
                    _WinAPI_SelectObject($hDC, $hOldPen)
                    _WinAPI_SelectObject($hDC, $hOldBrush)

                    $clrForeground = _WinAPI_SetTextColor($hDC, 0xFF0000)
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight)
                Else
                    $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText)
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow)
                    _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm)
                EndIf
                DllStructSetData($tRect, "Left", $aRect[0]+4)
                DllStructSetData($tRect, "Top", $aRect[1]+4)
                DllStructSetData($tRect, "Bottom", $aRect[3]-2)

                _WinAPI_DrawText($hDC, $sText, $tRect, BitOR($DT_LEFT, $DT_VCENTER))
                _WinAPI_SetTextColor($hDC, $clrForeground)
                _WinAPI_SetBkColor($hDC, $clrBackground)
        EndSwitch
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc

Func _WinAPI_Rectangle($hDC, $iLeft, $iTop, $iRight, $iBottom)
    Local $aResult = DllCall("gdi32.dll", "int", "Rectangle", "hwnd", $hDC, "int", $iLeft, "int", $iTop, "int", $iRight, "int", $iBottom)

    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0] <> 0
EndFunc

The _WM_DRAWITEM handler is invoked whenever an item should be painted with it's current state. The item can be in states such as: selected, highlighted, normal, etc.. Once you've identified the state of the item, you're free to do whatever that is possible to be done. You can, for example, use GDI+ and create a Graphics object from the DC handle and draw a rectangle with gradual interior.

Search MSDN for ComboBox controls and read the owner-drawn section sample.

Edit: Here is an example of the color-pick combo box:

#include <GUIComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global Const $ODT_MENU          = 1
Global Const $ODT_LISTBOX       = 2
Global Const $ODT_COMBOBOX      = 3
Global Const $ODT_BUTTON        = 4
Global Const $ODT_STATIC        = 5
Global Const $ODT_HEADER        = 100
Global Const $ODT_TAB           = 101
Global Const $ODT_LISTVIEW      = 102

Global Const $ODA_DRAWENTIRE    = 1
Global Const $ODA_SELECT        = 2
Global Const $ODA_FOCUS         = 4

Global Const $ODS_SELECTED      = 1
Global Const $ODS_GRAYED        = 2
Global Const $ODS_DISABLED      = 4
Global Const $ODS_CHECKED       = 8
Global Const $ODS_FOCUS         = 16
Global Const $ODS_DEFAULT       = 32
Global Const $ODS_HOTLIGHT      = 64
Global Const $ODS_INACTIVE      = 128
Global Const $ODS_NOACCEL       = 256
Global Const $ODS_NOFOCUSRECT   = 512
Global Const $ODS_COMBOBOXEDIT  = 4096

Global Const $clrWindowText     = _WinAPI_GetSysColor($COLOR_WINDOWTEXT)
Global Const $clrHighlightText  = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT)
Global Const $clrHighlight     = _WinAPI_GetSysColor($COLOR_HIGHLIGHT)
Global Const $clrWindow         = _WinAPI_GetSysColor($COLOR_WINDOW)

Global Const $tagDRAWITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemAction;' & _
    'uint itemState;' & _
    'hwnd hwndItem;' & _
    'hwnd hDC;' & _
    $tagRECT & _
    ';ulong_ptr itemData;'

Global Const $tagMEASUREITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemWidth;' & _
    'uint itemHeight;' & _
    'ulong_ptr itemData;'


Global $hGUI
Global $ComboBox
Global $hBrushNorm = _WinAPI_CreateSolidBrush($clrWindow)
Global $hBrushSel  = _WinAPI_CreateSolidBrush($clrHighlight)
Global $hBrushes[20] = [_WinAPI_CreateSolidBrush(0xFFFFFF)]

For $i = 1 To UBound($hBrushes)-1
    $hBrushes[$i] = _WinAPI_CreateSolidBrush(Random(0, 16777215, 1))
Next

GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM')
GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM')

$hGUI = GUICreate('Test', 220, 300)
$ComboBox = GUICtrlCreateCombo('', 10, 10, 200, 300, BitOR($WS_CHILD, $CBS_OWNERDRAWVARIABLE, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $__COMBOBOXCONSTANT_WS_VSCROLL))
GUICtrlSetData($ComboBox, "Auto|||||||||||||||||||")

GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

For $i = 0 To UBound($hBrushes)-1
    _WinAPI_DeleteObject($hBrushes[$i])
Next
_WinAPI_DeleteObject($hBrushSel)
_WinAPI_DeleteObject($hBrushNorm)
GUIDelete()

Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tMIS = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemWidth, $iItemHeight
    Local $hComboBox
    Local $tSize
    Local $sText

    $iCtlType    = DllStructGetData($tMIS, 'CtlType')
    $iCtlID      = DllStructGetData($tMIS, 'CtlID')
    $iItemID     = DllStructGetData($tMIS, 'itemID')
    $iItemWidth  = DllStructGetData($tMIS, 'itemWidth')
    $iItemHeight = DllStructGetData($tMIS, 'itemHeight')
    $hComboBox   = GUICtrlGetHandle($iCtlID)

    If $iCtlType = $ODT_COMBOBOX Then DllStructSetData($tMIS, 'itemHeight', 20)

    Return $GUI_RUNDEFMSG
EndFunc

Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam)
    Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState
    Local $clrForeground, $clrBackground
    Local $hWndItem, $hDC, $hOldPen, $hOldBrush
    Local $tRect, $aRect[4]
    Local $sText

    $iCtlType    = DllStructGetData($tDIS, 'CtlType')
    $iCtlID      = DllStructGetData($tDIS, 'CtlID')
    $iItemID     = DllStructGetData($tDIS, 'itemID')
    $iItemAction = DllStructGetData($tDIS, 'itemAction')
    $iItemState  = DllStructGetData($tDIS, 'itemState')
    $hWndItem    = DllStructGetData($tDIS, 'hwndItem')
    $hDC         = DllStructGetData($tDIS, 'hDC')
    $tRect       = DllStructCreate($tagRECT)

    If $iCtlType = $ODT_COMBOBOX Then
        Switch $iCtlID
            Case $ComboBox
                For $i = 1 To 4
                    DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7))
                    $aRect[$i-1] = DllStructGetData($tRect, $i)
                Next

                _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText)

                If BitAND($iItemState, $ODS_SELECTED) Then
                    $clrForeground = _WinAPI_SetTextColor($hDC, $clrHighlightText)
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight)
                    _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushSel)
                Else
                    $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText)
                    $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow)
                    _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm)
                EndIf

                If $sText <> "" Then
                    _WinAPI_DrawText($hDC, $sText, $tRect, BitOR($DT_CENTER, $DT_VCENTER))
                Else

                    If $iItemID <> 4294967295 Then
                        DllStructSetData($tRect, "Left",   $aRect[0] + 10)
                        DllStructSetData($tRect, "Top",    $aRect[1] + 2)
                        DllStructSetData($tRect, "Right",  $aRect[2] - 10)
                        DllStructSetData($tRect, "Bottom", $aRect[3] - 2)
                        _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushes[$iItemID])
                    Else
                        _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushes[0])
                    EndIf
                EndIf
                _WinAPI_SetTextColor($hDC, $clrForeground)
                _WinAPI_SetBkColor($hDC, $clrBackground)
        EndSwitch
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc
Edited by Authenticity
Link to comment
Share on other sites

As for the dropdown arrow, you can subclass the window and handle WM_PAINT event, but I suspect it's the same as the following. The scroll bar is a system wide control (like a menu) that can be tweaked globally by the user, or programmatically using these functions. It'd probably be much easier to create your own control and define it's characteristics.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...