OSDN Git Service

大破のときのHPのフォントを変える
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 6 May 2019 12:46:53 +0000 (21:46 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 6 May 2019 13:04:27 +0000 (22:04 +0900)
KancolleSniffer/View/MainFormLabels.cs
KancolleSniffer/View/ShipLabel.cs

index 391eee9..92566ac 100644 (file)
@@ -348,6 +348,7 @@ namespace KancolleSniffer.View
                 if (i >= timers.Length || timers[i].Span == TimeSpan.MinValue)\r
                 {\r
                     label.Visible = false;\r
+                    labelHp.ForeColor = Control.DefaultForeColor;\r
                     continue;\r
                 }\r
                 var timer = timers[i];\r
@@ -357,7 +358,10 @@ namespace KancolleSniffer.View
                 label.ForeColor = Control.DefaultForeColor;\r
                 labelName.SetName(stat, ShipNameWidth.AkashiTimer);\r
                 if (timer.Diff == 0)\r
+                {\r
+                    labelHp.ForeColor = Control.DefaultForeColor;\r
                     continue;\r
+                }\r
                 if (i == shortest)\r
                     label.ForeColor = CUDColors.Red;\r
                 labelHp.SetHp(stat.NowHp + timer.Diff, stat.MaxHp);\r
index 8753cd3..33366c6 100644 (file)
@@ -36,6 +36,11 @@ namespace KancolleSniffer.View
         private SlotStatus _slotStatus;\r
         private ShipStatus _status;\r
         private bool _hpPercent;\r
+        private Font _strongFont;\r
+\r
+        private Font BaseFont => Parent.Font;\r
+\r
+        private Font StrongFont => _strongFont ?? (_strongFont = new Font("Leelawadee", BaseFont.Size));\r
 \r
         public override Color BackColor\r
         {\r
@@ -106,15 +111,15 @@ namespace KancolleSniffer.View
             _slotStatus = slotStatus;\r
             var lu = new Regex(@"^\p{Lu}").IsMatch(name);\r
             var shift = (int)Round(ScaleFactor.Height);\r
-            if (lu && Font.Equals(Parent.Font))\r
+            if (lu && Font.Equals(BaseFont))\r
             {\r
                 Location += new Size(0, -shift);\r
                 Font = LatinFont;\r
             }\r
-            else if (!lu && !Font.Equals(Parent.Font))\r
+            else if (!lu && !Font.Equals(BaseFont))\r
             {\r
                 Location += new Size(0, shift);\r
-                Font = Parent.Font;\r
+                Font = BaseFont;\r
             }\r
             var result = prefix + name;\r
             var measured = TextRenderer.MeasureText(result, Font).Width;\r
@@ -144,12 +149,13 @@ namespace KancolleSniffer.View
                 Text = "";\r
                 ForeColor = DefaultForeColor;\r
                 BackColor = PresetColor;\r
+                Font = BaseFont;\r
                 return;\r
             }\r
             Text = _hpPercent\r
                 ? $"{(int)Floor(status.NowHp * 100.0 / status.MaxHp):D}%"\r
                 : $"{status.NowHp:D}/{status.MaxHp:D}";\r
-            ForeColor = status.DamageLevel == ShipStatus.Damage.Badly ? CUDColors.Yellow : DefaultForeColor;\r
+            Font = status.DamageLevel == ShipStatus.Damage.Badly ? StrongFont : BaseFont;\r
             BackColor = DamageColor(status);\r
         }\r
 \r