Article View: comp.windows.ms.programmer
Article #2324Colors in Edit Control
From: Kevin P. Kleinfelter
Date: Wed, 24 Apr 1991 18:12
Date: Wed, 24 Apr 1991 18:12
39 lines
1941 bytes
1941 bytes
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.
Technical Details
Message-ID:
<1615@msa3b.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!emory!wa4mei!nanovx!msa3b!kevinShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!emory!wa4mei!nanovx!msa3b!kevin From: kevin@msa3b.UUCP (Kevin P. Kleinfelter) Newsgroups: comp.windows.ms.programmer Subject: Colors in Edit Control Message-ID: <1615@msa3b.UUCP> Date: 24 Apr 91 18:12:14 GMT Organization: Dun and Bradstreet Software, Inc., Atlanta, GA Lines: 39