From 8f92be3c6b532838a649bfa089526ecdb28332fa Mon Sep 17 00:00:00 2001 From: Steve Browne Date: Tue, 24 Nov 2015 19:44:26 -0500 Subject: [PATCH] Improved readability of font changes to wxRendererMSW::GetCheckBoxSize and no longer force the window to redraw. --- src/msw/renderer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index 48350bdfe5..01054e7007 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -604,10 +604,13 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * win) wxON_BLOCK_EXIT1( ::DestroyWindow, hwndHeader ); - // Must ensure the proper font is set or the wrong value will be returned - // At 200% scaling it was returning a height of 28 when it should have been 40 - WXHANDLE hFont = (win && win->GetFont().IsOk() ? win->GetFont() : wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)).GetResourceHandle(); - ::SendMessage(hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); + // Set the font, even if it's the default one, before measuring the window. + wxFont font; + if ( win ) + font = win->GetFont(); + if ( !font.IsOk() ) + wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + ::SendMessage(hwndHeader, WM_SETFONT, (WPARAM)GetHfontOf(font), 0); // initialize the struct filled with the values by Header_Layout() RECT parentRect = { 0, 0, 100, 100 };