Ziggy Posted April 11, 2006 Posted April 11, 2006 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
diablo2oo2 Posted April 11, 2006 Posted April 11, 2006 (edited) there is also WM_CTLCOLORBTN WM_CTLCOLORSCROLLBAR maybe one this works...i also found this:http://www.asmcommunity.net/board/index.php?topic=7620.0http://www.asmcommunity.net/board/index.php?topic=6324.0so maybe WM_CTLCOLORLISTBOX must work? Edited April 11, 2006 by diablo2oo2
Ziggy Posted April 12, 2006 Author Posted April 12, 2006 Thanks diabloFinally 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 .endifHope someone else finds this useful one day.Z
diablo2oo2 Posted April 12, 2006 Posted April 12, 2006 good job ziggy. i posted your code to the winasm board.http://www.asmcommunity.net/board/index.ph...79465#msg179465
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now