From e9e14063f246a84e5bcbee68794126a6e51140d4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 May 2020 22:26:56 +0200 Subject: [PATCH] Account for the extra border around the thumb in wxMSW wxSlider Without the extra margin, part of the thumb was truncated when wxSL_TICKS was not used, but wxSL_BOTH (which makes the thumb bigger than without it) was. --- src/msw/slider.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/msw/slider.cpp b/src/msw/slider.cpp index 49e4bb07cb..d859ea5d55 100644 --- a/src/msw/slider.cpp +++ b/src/msw/slider.cpp @@ -548,7 +548,11 @@ wxSize wxSlider::DoGetBestSize() const { // this value is arbitrary: const int length = FromDIP(100); - const int thumbSize = GetThumbLength(); + + // We need 2 extra pixels (which are not scaled by the DPI by the native + // control) on either side to account for the focus rectangle. + const int thumbSize = GetThumbLength() + 4; + const int tickSize = FromDIP(TICK); int *width;