diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 5ef3128a7c..f7be3725be 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -240,6 +240,8 @@ protected: virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; #if wxUSE_RICHEDIT + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + // Apply the character-related parts of wxTextAttr to the given selection // or the entire control if start == end == -1. // diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 7b138bc75f..9118db73bd 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2633,6 +2633,16 @@ wxMenu *wxTextCtrl::MSWCreateContextMenu() return m; } +void wxTextCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI) +{ + // Don't do anything for the rich edit controls, they (somehow?) update + // their appearance on their own and changing their HFONT, as the base + // class version does, would reset all the styles used by them when the DPI + // changes, which is unwanted. + if ( !IsRich() ) + wxTextCtrlBase::MSWUpdateFontOnDPIChange(newDPI); +} + // ---------------------------------------------------------------------------- // EN_LINK processing // ----------------------------------------------------------------------------