using API on button colour?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Spaceman Spiff
User
User
Posts: 11
Joined: Mon Feb 15, 2010 9:13 pm

using API on button colour?

Post by Spaceman Spiff »

I got the following from the win32API guide:
Windows provides default color values for buttons. The system sends a WM_CTLCOLORBTN message to a button's parent window before the button is drawn. This message contains a handle of the button's device context and a handle of the child window. The parent window can use these handles to change the button's text and background colors. The following table shows the default button-color values.

Value Element colored
COLOR_BTNFACE Button faces.
COLOR_BTNHIGHLIGHT Highlight area (the top and left edges) of a button.
COLOR_BTNSHADOW Shadow area (the bottom and right edges) of a button.
COLOR_BTNTEXT Regular (nongrayed) text in buttons.
COLOR_GRAYTEXT Disabled (gray) text in buttons. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_WINDOW Window backgrounds.
COLOR_WINDOWFRAME Window frames.
COLOR_WINDOWTEXT Text in windows.


An application can retrieve the default values for these colors by calling the GetSysColor function, or set the values by calling the SetSysColors function. For more information about system colors, see System Information. For more information about how colors are used with controls, see Controls.



Portability Issue The WM_CTLCOLOR message has been replaced by the set of control-color messages. When porting your Windows 3.x - based application to the Win32 API, you must modify any code that processes the WM_CTLCOLOR message.
So how would I use the api to change a buttons colour to blue with yellow text?

I am stumped upside the head! 8)
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: using API on button colour?

Post by Rook Zimbabwe »

Well you could create a custom procedure to do this. I am still learning how myself... But I use Gnozals PUREcolor library... it is fast and functional.

http://freenet-homepage.de/gnozal/

Lots of nice tools on this site!!! :D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply