문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top