Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!fuug!tuura!risto From: risto@tuura.UUCP (Risto Lankinen) Newsgroups: comp.windows.ms.programmer Subject: Re: Control class colors Message-ID: <1163@tuura.UUCP> Date: 9 May 91 06:36:19 GMT References: <1991May3.213512.7371@ulowell.ulowell.edu> <917360id@cctb.wa.com> Organization: Nokia Data Systems Oy Lines: 35 curt@cctb.wa.com (Curt Johnson) writes: >In article <1991May3.213512.7371@ulowell.ulowell.edu> dpelland@hawk.ulowell.edu (David Pelland) writes: >| Could someone please enlighten me as to how I can set >| the background color of a control class window. I've >| tried doing it at creation time, and by processing the >| WM_CTLCOLOR message. I must be doing something wrong. >| Any help is appreciated. >| >| All I wanted was a red button... :( Hi! If the control were made (or changed) to have BS_OWNERDRAW style, its parent will start receiving WM_DRAWITEM messages. By responding to that message, the button can be painted however one likes. The lParam of the WM_DRAWITEM points to a DRAWITEMSTRUCT, one field of which is the hDC of the button. You will have to paint the button by yourself altogether, which means that you'll lose the 3D'ity unless you paint it that way. I've used the owner draw buttons, and I solved the problem by designing a few icons to represent the normal/clicked/selected status, which had the 3D look, and then drew the corresponding icon in response to the WM_DRAWITEM . Using prepainted icons has a drawback in that their color cannot be easily changed should the ButtonFace setting in WIN.INI be non-default, but if you want it red, then I guess that matters not much... Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************