Click to See Complete Forum and Search --> : Owner-draw button


links
November 19th, 2008, 07:56 AM
I've just started out with owner-drawn buttons. When I create a owner-drawn button the button rectangle gets painted with the same color as a dialog's background.

I've successfully painted over this handling the WM_DRAWITEM message.

I'm trying to figure out where this dialog-color painting is coming from (e.g. during what message is the window painted) since I want to make use of transparency effects on my button and thus need the dialog-colored block removed.

For what is is worth, I've noticed that the normal push button also includes the dialog-colored "background" at its outer edges (please see attached image).

I know how to remove the dialog-colored background from a static image by handling WM_CTLCOLORSTATIC, but I'm a bit lost with this button.

Any ideas please?

MikeAThon
November 19th, 2008, 11:31 AM
There are dozens of examples ou there of owner-drawn buttons and transparent background buttons. Look at http://www.codeguru.com/cpp/controls/buttonctrl/ for some solutions

Mike

links
November 19th, 2008, 01:28 PM
Thanks for the link. I've looked at the examples but most of them use MFC which I know nothing about and find it difficult to figure out exactly whats going on.

I've figured out that I need to handle the WM_CTLCOLORBTN message. Everything is not perfect yet, but it works better.

fred100
November 19th, 2008, 09:15 PM
See rather the dozens of MS samples in C in MSDN, PSDK, KB, etc