fixed wxBitmapButton bug with bitmaps with masks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-12-15 00:28:42 +00:00
parent ad81651f00
commit 2e8005ccaf

View File

@ -178,13 +178,22 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
// the fg ROP is applied for the pixels of the mask bitmap which are 1 // the fg ROP is applied for the pixels of the mask bitmap which are 1
// (for a wxMask this means that this is a non transparent pixel), the // (for a wxMask this means that this is a non transparent pixel), the
// bg ROP is applied for all the others // bg ROP is applied for all the others
wxColour colBg = GetBackgroundColour();
HBRUSH hbrBackground =
::CreateSolidBrush(RGB(colBg.Red(), colBg.Green(), colBg.Blue()));
HBRUSH hbrOld = (HBRUSH)::SelectObject(hDC, hbrBackground);
ok = ::MaskBlt( ok = ::MaskBlt(
hDC, x1, y1, wBmp, hBmp, // dst hDC, x1, y1, wBmp, hBmp, // dst
memDC, 0, 0, // src memDC, 0, 0, // src
(HBITMAP)mask->GetMaskBitmap(), 0, 0, // mask (HBITMAP)mask->GetMaskBitmap(), 0, 0, // mask
MAKEROP4(SRCCOPY, // fg ROP MAKEROP4(SRCCOPY, // fg ROP
SRCPAINT) // bg ROP PATCOPY) // bg ROP
); );
::SelectObject(hDC, hbrOld);
::DeleteObject(hbrBackground);
} }
else else
{ {