Sign in to follow this  

win32: Setting background colors for edit boxes

Recommended Posts

Control color handling is WM_CTLCOLOREDIT in Win32, I believe, unless you have it disabled or set to read only in which case it's WM_CTLCOLORSTATIC, or unless it's a rich edit control in which case it's EM_SETBKGNDCOLOR.

If you handle the WM_CTLCOLOREDIT in the parent window like this, the WPARAM is going to be the device context of the control, and you should end up with what you want:

hdc = (HDC)wParam;
SetTextColor(hdc, RGB(255,0,0)); /* red */
SetBkColor(hdc, RGB(255,255,0)); /* yellow */
return GetSysColorBrush(COLOR_3DHILIGHT); /* hilight colour */


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