Fix over scaled controls on windows (#13117)

init
This commit is contained in:
yw4z
2026-04-14 17:48:38 +03:00
committed by GitHub
parent be2a2d4873
commit 17e6ea8632
3 changed files with 47 additions and 6 deletions

View File

@@ -138,6 +138,10 @@ void SwitchButton::Rescale()
memdc.SelectObject(bmp);
#endif
memdc.SetFont(dc.GetFont());
#ifdef __WXMSW__
const double scale = GetDPIScaleFactor();
fontScale = scale;
#endif
if (fontScale) {
memdc.SetFont(dc.GetFont().Scaled(fontScale));
textSize[0] = memdc.GetTextExtent(labels[0]);
@@ -176,6 +180,8 @@ void SwitchButton::Rescale()
memdc.SelectObject(wxNullBitmap);
#ifdef __WXOSX__
bmp = wxBitmap(bmp.ConvertToImage(), -1, scale);
#elif defined(__WXMSW__)
bmp.SetScaleFactor(scale); // ORCA
#endif
(i == 0 ? m_off : m_on).bmp() = bmp;
}