Re: Setting the bkgrnd color of a control
- Posted by euman at bellsouth.net Apr 25, 2002
- 417 views
Hi Chris, if iMsg = WM_CREATE then Editbrush = CreateSolidBrush(16777215) elsif iMsg = WM_CTLCOLOREDIT then if lParam = EditContol then SetBkColor(wParam, 16777215) return Editbrush end if elsif iMsg = WM_CTLCOLORSTATIC then if lParam = EditControl then SetBkColor(wParam, 16777215) return Editbrush else return 0 end if elsif iMsg = WM_CTLCOLORLISTBOX then SetBkColor(wParam, rgb(5, 5, 192)) return Editbrush remember this Chris, you have to return the brush itself....... 16777215 is white I think so you'll need to change this to the color you want. WM_CTLCOLORSTATIC is for readonly MLE's WM_CTLCOLOREDIT is for non readonly MLE's WM_CTLCOLORLISTBOX is for the listbox's actually, SetBkColor(wParam, 16777215) in each of these is for your next question you might have on the colors of Edit controls..... just jokin' Hope it helps, Euman ----- Original Message ----- From: "Chris Bensler" <bensler at mail.com> To: "EUforum" <EUforum at topica.com> Sent: Thursday, April 25, 2002 4:23 PM Subject: Setting the bkgrnd color of a control > > Can someone please give me an example of setting the background color of > controls, using low level win32? > > I want to change the color of my mle's and various other controls. > > I've looked at win32lib, and it uses SetClassLong(hwnd, > GCL_HBRBACKGROUND, hbrush) and repaints the window, but I guess I'm > missing some details, because I can't get it to work. > > I've looked into the win32 SDK, and WM_CTLCOLOREDIT supposedly does what > I want, by returning the new bk brush from the event handler. > But I haven't been successful. > > Chris > > > >