Don't change RICHEDIT control font on DPI change

The control seems to somehow react to DPI changes on its own (which is
rather mysterious as we don't forward WM_DPICHANGED to it, so it's not
really clear how does it do it, but it does) and changing its font is
worse than useless, as it's not just redundant, but also resets all the
styles used inside the control and so is really undesirable.

Hence override the just added MSWUpdateFontOnDPIChange() to do nothing
for rich edit controls, while still updating the font for the plain EDIT
ones (which is required as they don't scale correctly on their own).
This commit is contained in:
Vadim Zeitlin
2018-12-31 01:52:12 +01:00
committed by Maarten Bent
parent 32aabf7a41
commit 37be4adec6
2 changed files with 12 additions and 0 deletions

View File

@@ -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
// ----------------------------------------------------------------------------