OSDN Git Service

ズーム時に艦娘一覧の下のほうが表示できないのを直す
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Fri, 28 Apr 2017 13:25:04 +0000 (22:25 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Fri, 28 Apr 2017 13:42:44 +0000 (22:42 +0900)
KancolleSniffer/ShipListPanel.cs

index 509e083..554e2ab 100644 (file)
@@ -18,6 +18,7 @@ using System.Drawing;
 using System.Linq;\r
 using System.Runtime.InteropServices;\r
 using System.Windows.Forms;\r
+using static System.Math;\r
 \r
 namespace KancolleSniffer\r
 {\r
@@ -67,7 +68,7 @@ namespace KancolleSniffer
 \r
         protected override void OnMouseWheel(MouseEventArgs e)\r
         {\r
-            ScrollBar.Value = Math.Max(ScrollBar.Minimum, Math.Min(ScrollBar.Maximum - ScrollBar.LargeChange + 1,\r
+            ScrollBar.Value = Max(ScrollBar.Minimum, Min(ScrollBar.Maximum - ScrollBar.LargeChange + 1,\r
                 ScrollBar.Value - e.Delta * SystemInformation.MouseWheelScrollLines / 120));\r
         }\r
 \r
@@ -189,7 +190,7 @@ namespace KancolleSniffer
 \r
         private void SetupScrollBar()\r
         {\r
-            var needBar = _shipList.Length * LineHeight > Height;\r
+            var needBar = _shipList.Length * LineHeight * ShipLabel.ScaleFactor.Height > Height;\r
             if (!needBar)\r
             {\r
                 ScrollBar.Visible = false;\r
@@ -198,12 +199,12 @@ namespace KancolleSniffer
             }\r
             ScrollBar.Visible = true;\r
             ScrollBar.Minimum = 0;\r
-            var lines = Math.Max(1, Height / LineHeight);\r
+            var lines = Max(1, Height / (int)Round(LineHeight * ShipLabel.ScaleFactor.Height));\r
             var max = _shipList.Length - lines;\r
-            ScrollBar.LargeChange = Math.Min(lines, max);\r
+            ScrollBar.LargeChange = Min(lines, max);\r
             ScrollBar.Maximum =\r
-                Math.Max(0, max + ScrollBar.LargeChange - 1); // ScrollBarを最大まで動かしてもmaxには届かない\r
-            ScrollBar.Value = Math.Min(ScrollBar.Value, max);\r
+                Max(0, max + ScrollBar.LargeChange - 1); // ScrollBarを最大まで動かしてもmaxには届かない\r
+            ScrollBar.Value = Min(ScrollBar.Value, max);\r
         }\r
 \r
         private void CreateGroupingComponents(int i)\r
@@ -470,7 +471,7 @@ namespace KancolleSniffer
             var i = Array.FindIndex(_shipList, s => s.Id == id);\r
             if (i == -1)\r
                 return;\r
-            ScrollBar.Value = Math.Min(i, ScrollBar.Maximum + 1 - ScrollBar.LargeChange);\r
+            ScrollBar.Value = Min(i, ScrollBar.Maximum + 1 - ScrollBar.LargeChange);\r
             SetShipLabels();\r
         }\r
     }\r