From 4aa7b5b3501ae6ca9c29bd426309ecfd1afeb2aa Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Thu, 29 Sep 2022 04:12:51 +0200 Subject: [PATCH] lcl: spin edit: scale UpDown with height --- lcl/interfaces/win32/win32wsspin.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/win32/win32wsspin.pp b/lcl/interfaces/win32/win32wsspin.pp index 8f71eeaab2..2e2dc3a128 100644 --- a/lcl/interfaces/win32/win32wsspin.pp +++ b/lcl/interfaces/win32/win32wsspin.pp @@ -322,7 +322,6 @@ begin WinHandle := AWinControl.Handle; UpDown := GetWin32WindowInfo(WinHandle)^.UpDown; - UpDownWidth := GetUpDownWidth(AWinControl); if (AWinControl as TCustomFloatSpinEdit).BorderStyle = bsNone then BorderWidth := 0 else if (WindowsVersion >= wvXP) and ThemeServices.ThemesEnabled then @@ -330,6 +329,8 @@ begin else BorderWidth := GetSystemMetrics(SM_CXEDGE); + UpDownWidth := (Height - BorderWidth * 2) div 5 * 4 +1 {to get odd number}; // calculate from height to scale it + DWP := BeginDeferWindowPos(2); DeferWindowPos(DWP, UpDown, WinHandle, Left + Width - UpDownWidth - BorderWidth, Top+BorderWidth, UpDownWidth, Height - BorderWidth * 2, SWP_NOACTIVATE);