home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!sybus.sybus.com!myrddin!tct!jeff
- From: jeff@tct.com (Jeff Witzer)
- Subject: WM_CTLCOLOR...
- Message-ID: <2B42FA87.FB0A@tct.com>
- Date: Thu, 31 Dec 1992 13:49:59 GMT
- Organization: TC Telemanagement, Clearwater, FL
- Lines: 52
-
- On December 4th of this year blakeco@microsoft.com posted this follow-up
- message:
-
- >In article <focke.125.723322161@gmd.de> focke@gmd.de (Stefan Focke) writes:
- >>I think, that it is not possible to change the color of the font used in a
- >>edit-class window.
- >
- >In the wndproc of your parent window add:
- >
- >case WM_CTLCOLOR:
- > if ((HWND)LOWORD(lParam) == hwndYourEditCtl)
- > SetTextColor((HDC)wParam,rgbYourTextColor);
- > return NULL;
- >
- >-Blake
- >--
- >#include <std/disclaimer.h> blakeco@microsoft.com
- >Mail Flames, Post Apologies. ...!uunet!microsoft!blakeco
-
- ...I think I have a related question.
-
- I am trying to display (in a dialog box) a grid of numbers whose color
- represents some condition (black - within range, red - above range, blue -
- below range). I have set up an array of OWNERDRAW controls and respond to
- the WM_DRAWITEM message with:
-
- FillRect (lpdis->hDC, &lpdis->rcItem, GetStockObject (LTGRAY_BRUSH);
- SetTextColor (lpdis->hDC, RGBValue);
- DrawText (lpdis->hDC, "text", -1, &lpdis->rdItem, DT_LEFT);
-
- (The color and text vary for each lpdis->CtlID, of course.) The FillRect ()
- call is done because I'm using Borland style dialog boxes and need to gray the
- background because Windows clears the OWNERDRAW background to white before I
- get the WM_DRAWITEM. This causes great amounts of flicker, as you can well
- imagine.
-
- Is there any way to have Windows fill OWNERDRAW backgrounds with another
- color (light gray in my case)?
-
- The related question has to do with my attempts to use LTEXT controls in the
- place of the OWNERDRAW controls. I want to respond to the WM_CTLCOLOR message
- as Blake described and use the SetWindowText () function elsewhere in the
- process, but I never recieve the WM_CTLCOLOR message. Do I have to somehow
- tell windows to send me that message for static controls?
-
- Also, what is the CTLCOLOR_STATIC (6) message used for?
-
- Thanks,
-
- jeff@tct.com
-
-
-