using System.Linq;\r
using System.Runtime.InteropServices;\r
using System.Windows.Forms;\r
+using static System.Math;\r
\r
namespace KancolleSniffer\r
{\r
\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
\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
}\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
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