From c96fc29a52abf095d133c6c7798794945119f040 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 21 Jan 2014 18:39:09 +0000 Subject: [PATCH] Draw the selected bitmap correctly in wxMSW buttons. Clear the previously drawn bitmap before drawing the new one. Closes #12550. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/anybutton.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1e3dc43585..7b7928a71d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -27,3 +27,4 @@ wxMSW: - Improve wxMimeTypesManager open command detection (Eric Jensen). - Make wxFILTER_INCLUDE_LIST in wxTextValidator actually usable. +- Fix handling of selected images in wxBitmapButton (Artur Wieczorek). diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index a930d3c11a..6a964f059d 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -1175,7 +1175,13 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) } } } - + else + { + // clear the background (and erase any previous bitmap) + COLORREF colBg = wxColourToRGB(GetBackgroundColour()); + AutoHBRUSH hbrushBackground(colBg); + FillRect(hdc, &rectBtn, hbrushBackground); + } // draw the image, if any if ( m_imageData )