OSDN Git Service

すべてのウィンドウで艦娘名のツールチップに装備を表示する
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / View / ShipListPanel / ShipListLabels.cs
index 625fa9a..dbbad36 100644 (file)
@@ -15,6 +15,7 @@
 using System.Collections.Generic;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
+using KancolleSniffer.Forms;\r
 \r
 namespace KancolleSniffer.View.ShipListPanel\r
 {\r
@@ -37,20 +38,37 @@ namespace KancolleSniffer.View.ShipListPanel
                 Fleet = new ShipLabel.Fleet(new Point(1, 2)),\r
                 Name = new ShipLabel.Name(new Point(10, 2), ShipNameWidth.ShipList),\r
                 Hp = new ShipLabel.Hp(new Point(126, 0), ShipListPanel.LineHeight),\r
-                Cond = new ShipLabel.Cond(new Point(128, 0), ShipListPanel.LineHeight),\r
-                Level = new ShipLabel.Level(new Point(154, 2), height),\r
-                Exp = new ShipLabel.Exp(new Point(175, 2), height),\r
+                Cond = new ShipLabel.Cond(new Point(127, 0), ShipListPanel.LineHeight),\r
+                Level = new ShipLabel.Level(new Point(152, 2), height),\r
+                Exp = new ShipLabel.Exp(new Point(174, 2), height),\r
                 BackPanel =  new Panel\r
                 {\r
                     Location = new Point(0, y),\r
                     Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),\r
+                    Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top\r
                 }\r
             };\r
+            SetAnchorRight(labels.Hp, labels.Cond, labels.Level, labels.Exp);\r
             _labelList.Add(labels);\r
             labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i));\r
+            labels.Scale();\r
             _shipListPanel.SetHpPercent(labels.Hp);\r
         }\r
 \r
+        private void SetAnchorRight(params Control[] controls)\r
+        {\r
+            foreach (var control in controls)\r
+                control.Anchor = AnchorStyles.Top | AnchorStyles.Right;\r
+        }\r
+\r
+        public void Resize(int i, int width)\r
+        {\r
+            var labels = _labelList[i];\r
+            labels.BackPanel.Width = width;\r
+            labels.Hp.AdjustLocation();\r
+            labels.Name.AdjustWidth(Scaler.DownWidth(width) - ListForm.PanelWidth);\r
+        }\r
+\r
         public void SetShipStatus(int i)\r
         {\r
             var s = _shipListPanel.GetShip(i);\r
@@ -60,7 +78,7 @@ namespace KancolleSniffer.View.ShipListPanel
                 SetShipType(i);\r
                 return;\r
             }\r
-            labels.Set(s);\r
+            labels.Set(s, _shipListPanel.ToolTip);\r
             labels.BackPanel.Visible = true;\r
         }\r
 \r