kevin@msa3b.UUCP (Kevin P. Kleinfelter) (04/25/91)
I'm trying to create an edit control with red text on a pale yellow background.
In my window proc I have:
case WM_CTLCOLOR:
if (HIWORD (lParam) == CTLCOLOR_EDIT) {
SetBkColor (wParam, 0x7fffff);
SetTextColor (wParam, (COLORREF) 0x0ff);
UnrealizeObject (PaleYellowBrush); /* BS_SOLID, 0x7fffff, 0 */
return PaleYellowBrush;
}
break;
This gives me a background with color 0x00ffff (bright yellow).
In fact, it appears that text can only the 8 primary colors as background
(IBM PS/2 motherboard VGA).
So, in an attempt to be clever, I changed the code to:
case WM_CTLCOLOR:
if (HIWORD (lParam) == CTLCOLOR_EDIT) {
SetBkColor (wParam, 0x7fffff);
SetTextColor (wParam, (COLORREF) 0x0ff);
SetBkMode (wParam, TRANSPARENT);
UnrealizeObject (PaleYellowBrush); /* BS_SOLID, 0x7fffff, 0 */
return PaleYellowBrush;
}
This gives my text a pale yellow background. However, character positions
in the edit AFTER any entered text are WHITE. i.e. If I fill the edit
with text, it all has pale yellow background, but if I move the cursor to
the beginning of the field and press DEL a few times, WHITE spaces start
coming in from the end of the edit.
What is the simplest way to get an edit control with a pale yellow background?
--
Kevin Kleinfelter @ Dun and Bradstreet Software, Inc (404) 239-2347
...gatech!nanovx!msa3b!kevin
Warning: There seem to be multiple 'msa3b' nodes on Usenet, and it is
nanoVX, not nanovAx.