Fix height of rich wxTextCtrl after DPI change

The font of rich controls is not adjusted when the DPI changes, so do it here.
This commit is contained in:
Maarten Bent
2019-11-05 22:07:04 +01:00
parent fcda2beabb
commit 4340e46b72

View File

@@ -2538,8 +2538,10 @@ wxSize wxTextCtrl::DoGetBestSize() const
wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
{
int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
int cy;
wxFont font = GetFont();
font.WXAdjustToPPI(GetDPI());
wxGetCharSize(GetHWND(), NULL, &cy, font);
DWORD wText = FromDIP(1);
::SystemParametersInfo(SPI_GETCARETWIDTH, 0, &wText, 0);
@@ -2890,7 +2892,7 @@ bool wxTextCtrl::SetFont(const wxFont& font)
{
// Native text control sends EN_CHANGE when the font changes, producing
// a wxEVT_TEXT event as if the user changed the value. This is not
// the case, so supress the event.
// the case, so suppress the event.
wxEventBlocker block(this, wxEVT_TEXT);
if ( !wxTextCtrlBase::SetFont(font) )