News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Change Button Color

Started by peaslee, September 20, 2015, 03:36:40 AM

Previous topic - Next topic

peaslee

I have been able to change the background of my dialog as well as the static controls, but now the "Close" button sticks out. How do I change the button color to match that of the dialog?


peaslee

Zen,

I found that earlier because a similar message works for static controls. I cannot get WM_CTLCOLORBTN to work. Some folks on the web say it has been eliminated, some that it requires an owner draw button, and some say it never worked.

What I would like would be a simple working example.

Thanks for the response.

dedndave

i don't remember ever seeing it work - lol

the button is a tough one - especially on windows 7 or later
the actual button window is a child of a child "worker" window
so, subclassing it is no easy task, either

i've found that, rather than subclassing, write your own button window   :t

jj2007

It's tricky indeed. Here they claim that buttons with any *push style can change colours, but I can't confirm that for Win7-64. Besides, notify/NM_CUSTOMDRAW is being proposed.

MichaelW

You could try changing the button style to one where you can control the color.

SetWindowLongPtr

And if you need to know what the style, or whatever, is GetWindowLongPtr.
Well Microsoft, here's another nice mess you've gotten us into.