home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4532 < prev    next >
Encoding:
Text File  |  1992-12-31  |  2.2 KB  |  62 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tct!jeff
  3. From: jeff@tct.com (Jeff Witzer)
  4. Subject: WM_CTLCOLOR...
  5. Message-ID: <2B42FA87.FB0A@tct.com>
  6. Date: Thu, 31 Dec 1992 13:49:59 GMT
  7. Organization: TC Telemanagement, Clearwater, FL
  8. Lines: 52
  9.  
  10. On December 4th of this year blakeco@microsoft.com posted this follow-up 
  11. message:
  12.  
  13. >In article <focke.125.723322161@gmd.de> focke@gmd.de (Stefan Focke) writes:
  14. >>I think, that it is not possible to change the color of the font used in a 
  15. >>edit-class window. 
  16. >
  17. >In the wndproc of your parent window add:
  18. >
  19. >case WM_CTLCOLOR:
  20. >    if ((HWND)LOWORD(lParam) == hwndYourEditCtl)
  21. >        SetTextColor((HDC)wParam,rgbYourTextColor);
  22. >    return NULL;
  23. >
  24. >-Blake
  25. >-- 
  26. >#include <std/disclaimer.h>                      blakeco@microsoft.com
  27. >Mail Flames, Post Apologies.                     ...!uunet!microsoft!blakeco
  28.  
  29. ...I think I have a related question.  
  30.  
  31. I am trying to display (in a dialog box) a grid of numbers whose color 
  32. represents some condition (black - within range, red - above range, blue -
  33. below range).  I have set up an array of OWNERDRAW controls and respond to 
  34. the WM_DRAWITEM message with:
  35.  
  36.     FillRect (lpdis->hDC, &lpdis->rcItem, GetStockObject (LTGRAY_BRUSH);
  37.     SetTextColor (lpdis->hDC, RGBValue);
  38.     DrawText (lpdis->hDC, "text", -1, &lpdis->rdItem, DT_LEFT);
  39.             
  40. (The color and text vary for each lpdis->CtlID, of course.)  The FillRect ()
  41. call is done because I'm using Borland style dialog boxes and need to gray the
  42. background because Windows clears the OWNERDRAW background to white before I 
  43. get the WM_DRAWITEM.  This causes great amounts of flicker, as you can well 
  44. imagine.
  45.  
  46. Is there any way to have Windows fill OWNERDRAW backgrounds with another 
  47. color (light gray in my case)?
  48.  
  49. The related question has to do with my attempts to use LTEXT controls in the
  50. place of the OWNERDRAW controls.  I want to respond to the WM_CTLCOLOR message
  51. as Blake described and use the SetWindowText () function elsewhere in the 
  52. process, but I never recieve the WM_CTLCOLOR message.  Do I have to somehow
  53. tell windows to send me that message for static controls?  
  54.  
  55. Also, what is the CTLCOLOR_STATIC (6) message used for?
  56.  
  57. Thanks,
  58.  
  59. jeff@tct.com
  60.  
  61.  
  62.