Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Combobox Background Colour

Featured Replies

Posted

I want to change the background colour of a ComboBox control.

For static and edit controls this can easily be done by handling the WM_CTLCOLORSTATIC or WM_CTLCOLOREDIT messages. But I don't know what to use for a ComboBox. WM_CTLCOLORLISTBOX doesn't work and a search hasn't turned up much of any use.

Any help appreciated please.

Z

  • Author

Thanks diablo

Finally go it working with some trial and error.

Since a ComboBox has 2 parts - EditControl and DropDownList both need to be handled separately.

in the main windows message processing you need to

process the EDITCONTROL part of the ComboBox

.elseif uMsg==WM_CTLCOLOREDIT

mov eax, lParam

.if eax==hComboSelect ; ComboBox handle

invoke SetBkMode,wParam,TRANSPARENT; Background of Edit Text

RGB 0,0,0 ; black background or whatever color you want

invoke SetBkColor, wParam, eax

RGB TextRed, TextGreen, TextBlue ;eax = Text colour

invoke SetTextColor,wParam, eax ;set TextColor

invoke GetStockObject,NULL_BRUSH ;return a brush

ret

.endif

and you need to subclass the ComboBox control and process the WM_CTLCOLORLISTBOX

for the drop down list

.if uMsg==WM_CTLCOLORLISTBOX

invoke SetBkMode,wParam,TRANSPARENT ;Background of list Text

RGB TextRed, TextGreen, TextBlue ;eax = Text colour

invoke SetTextColor,wParam, eax ;set TextColor

invoke CreateSolidBrush, 00h ; black brush or whatever color you want

ret

.endif

Hope someone else finds this useful one day.

Z

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.