Refresh wxMSW wxStaticBitmap when its size changes.

As MSW native control centers the image, it must be entirely redrawn when the
area in which the image is centered changes, but it doesn't happen by default,
so do it ourselves explicitly.

Also explain that this centering behaviour is platform-specific and shouldn't
be relied upon.

Closes #4564.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-02-09 00:35:54 +00:00
parent 4bd1fc29b2
commit 05942059ef
3 changed files with 22 additions and 1 deletions

View File

@@ -42,9 +42,13 @@
#include <stdio.h>
// ---------------------------------------------------------------------------
// macors
// macros
// ---------------------------------------------------------------------------
wxBEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase)
EVT_SIZE(wxStaticBitmap::WXHandleSize)
wxEND_EVENT_TABLE()
// ===========================================================================
// implementation
// ===========================================================================
@@ -206,6 +210,15 @@ wxSize wxStaticBitmap::DoGetBestClientSize() const
return size;
}
void wxStaticBitmap::WXHandleSize(wxSizeEvent& event)
{
// Invalidate everything when our size changes as the image position (it's
// drawn centred in the window client area) changes.
Refresh();
event.Skip();
}
#ifndef __WXWINCE__
void wxStaticBitmap::DoPaintManually(wxPaintEvent& WXUNUSED(event))