diff --git a/include/wx/statbox.h b/include/wx/statbox.h index 0db5ada56c..968903b009 100644 --- a/include/wx/statbox.h +++ b/include/wx/statbox.h @@ -39,7 +39,7 @@ public: // borderOther is the margin on all other sides virtual void GetBordersForSizer(int *borderTop, int *borderOther) const { - const int BORDER = 5; // FIXME: hardcoded value + const int BORDER = FromDIP(5); // FIXME: hardcoded value *borderTop = GetLabel().empty() ? BORDER : GetCharHeight(); *borderOther = BORDER; diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 94e4208a30..1f242159f2 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1223,7 +1223,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // Make very small buttons square, as it makes // them accommodate arrow image better and still // looks decent. - if ( height > 18 ) + if ( height > FromDIP(18) ) butWidth = (height*butWidth)/bestHeight; else butWidth = butHeight; diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index 3de6859a98..d8850c0945 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -358,8 +358,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, wxRect ar = rect; // make a rect for the arrow - ar.height = 4; - ar.width = 8; + ar.SetSize(wxWindow::FromDIP(wxSize(8, 4), win)); ar.y += (rect.height - ar.height)/2; ar.x = ar.x + rect.width - 3*ar.width/2; arrowSpace = 3*ar.width/2; // space to preserve when drawing the label diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 62afc3ffa4..34ef696042 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -227,7 +227,7 @@ void wxComboCtrl::OnResize() // Technically Classic Windows style combo has more narrow button, // but the native renderer doesn't paint it well like that. - int btnWidth = 17; + int btnWidth = FromDIP(17); CalculateAreas(btnWidth); // Position textctrl using standard routine diff --git a/src/msw/control.cpp b/src/msw/control.cpp index bfdd906e37..daf7b06590 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -253,7 +253,7 @@ wxSize wxControl::DoGetBestSize() const if (m_windowSizer) return wxControlBase::DoGetBestSize(); - return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT); + return FromDIP(wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT)); } wxBorder wxControl::GetDefaultBorder() const diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index a390d5b86b..48350bdfe5 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -589,11 +589,11 @@ wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win)) ::GetSystemMetrics(SM_CYMENUCHECK)); } -int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) +int wxRendererMSW::GetHeaderButtonHeight(wxWindow * win) { // some "reasonable" value returned in case of error, it doesn't really // correspond to anything but it's better than returning 0 - static const int DEFAULT_HEIGHT = 20; + static const int DEFAULT_HEIGHT = wxWindow::FromDIP(20, win); // create a temporary header window just to get its geometry @@ -604,6 +604,11 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(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)); + // initialize the struct filled with the values by Header_Layout() RECT parentRect = { 0, 0, 100, 100 }; WINDOWPOS wp = { 0, 0, 0, 0, 0, 0, 0 }; diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index b58c0b9e28..a59da9107f 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -308,7 +308,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, if ( sizeText.x <= 0 ) { // DEFAULT_ITEM_WIDTH is the default width for the text control - sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; + sizeText.x = FromDIP(DEFAULT_ITEM_WIDTH) + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 90da8f3ea1..e7f90103a8 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2259,7 +2259,7 @@ bool wxTextCtrl::AcceptsFocusFromKeyboard() const wxSize wxTextCtrl::DoGetBestSize() const { - return DoGetSizeFromTextSize( DEFAULT_ITEM_WIDTH ); + return DoGetSizeFromTextSize( FromDIP(DEFAULT_ITEM_WIDTH) ); } wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const