X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8812e0986833a7b3cdf8cf113974c7c23f05ad18..3bf93e1e9ac6b61e5220967d2ada2d4faec4dd9c:/src/msw/stattext.cpp?ds=inline diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 59725f6c38..cc4b995d2d 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -23,14 +23,15 @@ #if wxUSE_STATTEXT #ifndef WX_PRECOMP -#include "wx/event.h" -#include "wx/app.h" -#include "wx/brush.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/brush.h" + #include "wx/dcclient.h" + #include "wx/settings.h" #endif #include "wx/stattext.h" #include "wx/msw/private.h" -#include #if wxUSE_EXTENDED_RTTI WX_DEFINE_FLAGS( wxStaticTextStyle ) @@ -128,7 +129,11 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const wxSize wxStaticText::DoGetBestSize() const { wxClientDC dc(wx_const_cast(wxStaticText *, this)); - dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); + wxFont font(GetFont()); + if (!font.Ok()) + font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + + dc.SetFont(font); wxCoord widthTextMax, heightTextTotal; dc.GetMultiLineTextExtent(GetLabel(), &widthTextMax, &heightTextTotal); @@ -138,7 +143,9 @@ wxSize wxStaticText::DoGetBestSize() const widthTextMax += 2; #endif // __WXWINCE__ - return wxSize(widthTextMax, heightTextTotal); + wxSize best(widthTextMax, heightTextTotal); + CacheBestSize(best); + return best; } void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)