Переглянути джерело

Prevent assertion when starting on 200% Windows 10

Source commit: 27152b734aaf322491231c85b9b8c9b650f4e9e0
Martin Prikryl 10 роки тому
батько
коміт
64f7ab815d
1 змінених файлів з 11 додано та 4 видалено
  1. 11 4
      source/components/ThemePageControl.cpp

+ 11 - 4
source/components/ThemePageControl.cpp

@@ -77,15 +77,22 @@ int __fastcall TThemePageControl::GetTabsHeight()
 
   // Two different ways to calculate the same, not sure which one is more reliable,
   // so we want to know in case they differ.
-  // On Windows 10 with 200% scaling, the first is 40, the second is 42.
-  // The correct size is probably 41. Will wait for final release before settling on solution.
   if (ALWAYS_TRUE(PageCount >= 0))
   {
     TRect Rect = TabRect(0);
     int Result2 = Rect.Bottom + 1;
-    if (ALWAYS_FALSE(Result != Result2))
+    if (Result != Result2)
     {
-      Result = Result2;
+      // On Windows 10 with 200% scaling, the first is 40, the second is 42.
+      // The correct size is probably 41. Will wait for final release before settling on solution.
+      if (ALWAYS_TRUE(IsWin10() && (Result - 2) == Result2))
+      {
+        Result--;
+      }
+      else
+      {
+        Result = Result2;
+      }
     }
   }