Update font of wxSpinCtrl when DPI changes

Fix position of spin control in wxSpinCtrlDouble after DPI change
The old size of the control was used to determine the position. Use GetBestSize
instead, which will return the correct size.
This commit is contained in:
Maarten Bent
2018-12-30 23:10:20 +01:00
parent 8bff737438
commit 32aabf7a41
3 changed files with 19 additions and 2 deletions

View File

@@ -223,6 +223,14 @@ void wxSpinCtrl::OnKillFocus(wxFocusEvent& event)
event.Skip();
}
void wxSpinCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
{
wxSpinButton::MSWUpdateFontOnDPIChange(newDPI);
if ( m_font.IsOk() )
wxSetWindowFont(GetBuddyHwnd(), m_font);
}
void wxSpinCtrl::OnSetFocus(wxFocusEvent& event)
{
// when we get focus, give it to our buddy window as it needs it more than
@@ -577,7 +585,8 @@ bool wxSpinCtrl::SetFont(const wxFont& font)
return false;
}
wxSetWindowFont(GetBuddyHwnd(), GetFont());
if ( m_font.IsOk() )
wxSetWindowFont(GetBuddyHwnd(), m_font);
return true;
}