Transparent owner-drawn button?
-
Hello all, I'm using a CMacButton that I got from http://codeguru.earthweb.com/controls/macbuttons.shtml The class doesn't automatically support transparency. However, I'm sure it can really easily because another programmer told me it could be done by commenting out the code that clears the area and draws the background. However, I couldn't figure out what to comment out. I'm new to owner drawn controls and I was wondering if someone could help. Thanks in advance.
-
Hello all, I'm using a CMacButton that I got from http://codeguru.earthweb.com/controls/macbuttons.shtml The class doesn't automatically support transparency. However, I'm sure it can really easily because another programmer told me it could be done by commenting out the code that clears the area and draws the background. However, I couldn't figure out what to comment out. I'm new to owner drawn controls and I was wondering if someone could help. Thanks in advance.
Hi Trey, I don't know the CMacButton class, but I think it's the same for all controls. You can get a transparent control by: - overriding OnEraseBackgnd (just return TRUE, without calling the base class implementation) - if you have other controls below the button, adding WS_EX_TRANSPARENT to the extended style of the button (so that it is the last to be repainted) Hope this is right, I used it with a CStatic with no problems. Cheers, Paolo.