From e431c7df61e57e2e55e20c3fe8e479bd635739d8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Jul 2009 23:01:10 +0000 Subject: [PATCH] Always correctly invalid best size when bitmap changes. Previously it was done only when the initial bitmap was set, not when it was subsequently changed. Closes #11018. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/button.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 49b84f2849..c81472bebc 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -959,16 +959,18 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which) m_imageData = new wxODButtonImageData(this, bitmap); MakeOwnerDrawn(); } - - // if a bitmap was assigned to the bitmap, its best size must be - // changed to account for it - InvalidateBestSize(); } else { m_imageData->SetBitmap(bitmap, which); } + // it should be enough to only invalidate the best size when the normal + // bitmap changes as all bitmaps assigned to the button should be of the + // same size anyhow + if ( which == State_Normal ) + InvalidateBestSize(); + Refresh(); } -- 2.45.2