How do I change the color of buttons?

BlitzPlus Forums/BlitzPlus Beginners Area/How do I change the color of buttons?

Parcival(Posted 2006) [#1]
Is it possible to change the backgroundcolor of gadgets like GUI-buttons? There is no SetGadgetColor...


Pineapple(Posted 2006) [#2]
In C++, a button (as well as other gadgets) are made using the CreateWindow WinAPI call. This is how I do it:-

Gadget = CreateWindow("Button",gadgetText,BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE ,x,y,length,20,m_hWindow,(HMENU)gadgetID,m_hInstance,0);

You could get a handle to the buttons device context using GetDC, then use SetDCBrushColor to change the colour of the button.

Wrap it up in a userlib and jobs a good'un!

Not sure if it's viable, though, it is an interesting idea! :)

Dabz

P.S. Sorry for being a fornight late, lol