X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ac10c957a501599358facf237ce037dd8fcbe908..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 89538fc884..cc4b995d2d 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -129,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); @@ -139,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)