Question

In WTL, CBitmapButton does not support picture with transparent layer, like PNG. so i customize the code to use GDI+ to draw PNG, name it as CPNGButton. But things are strange on win XP. When the button is overlaped by other window, the button receives WM_PAINT first, and then the parent, causing incorrect result.

enter image description here--->enter image description here

I check the resource and remove WS_TABSTOP attribute from the template of the button, things go ok,parent window receives WM_PAINT first, then the button. What cause WS_TABSTOP to affect window painting order?

Was it helpful?

Solution

This is what happens when you don't draw the background. That leaves a 'hole' in the window, you see the pixels of whatever window is behind yours. Or the desktop if there is no such window. Not otherwise sure what this has to do with WS_TABSTOP.

Use the WS_EX_TRANSPARENT style flag. That tells Windows that you want the parent of the button to draw itself in the client window to provide the background pixels.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top