wxMSW: wxDC destructor

Nusret Taşçı nusi at sofha.de
Thu Sep 21 14:06:05 PDT 2006


>  You need to call SetHDC(0) if you don't want wxClientDC to release the DC.
> There is wxDCTemp (used in the very same wxBitmapButton::MSWOnDraw() in cvs
> HEAD, although 2.6 does have the same bug, I'll fix it there) which makes
> this rather less painful.

Thank you Vadim!
I'm sorry, I've totally forgotten to say that I'm using wxUSE_UXTHEME 
with CVS HEAD. In that case the code follows a different path.
The code there looks like following:
bmpbutton.cpp at line 410:
         // draw the bitmap
         wxClientDC dst;
         dst.SetHDC((WXHDC) hDC, false);
         dst.DrawBitmap(*bitmap, x1, y1, true);

I think a fix is needed there, too.

In fact, I copied my code from there and didn't even bother looking 
below. Shame on me.

Best regards,
Nusi.




More information about the wx-users mailing list