SetupFleetClick();\r
CreateMainLabels();\r
CreateNumberAndHistory(manager);\r
- labelPresetAkashiTimer.BackColor = ShipLabel.ColumnColors[1];\r
+ labelPresetAkashiTimer.BackColor = CustomColors.ColumnColors.Bright;\r
SetupQuestPanel();\r
panelRepairList.CreateLabels(panelRepairList_Click);\r
PerformZoom();\r
{\r
Location = new Point(0, y),\r
Size = new Size(ListForm.PanelWidth, LineHeight),\r
- BackColor = ShipLabel.ColumnColors[(i + 1) % 2],\r
+ BackColor = CustomColors.ColumnColors.BrightFirst(i),\r
Visible = false\r
};\r
Scaler.Scale(lbp);\r
foreach (var label in labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
}\r
\r
{\r
Location = new Point(0, y),\r
Size = new Size(0, LineHeight),\r
- BackColor = ShipLabel.ColumnColors[i % 2],\r
+ BackColor = CustomColors.ColumnColors.DarkFirst(i),\r
Visible = false,\r
Tag = y\r
};\r
foreach (var label in friend.Concat(enemy))\r
{\r
panel.Controls.Add(label);\r
- label.BackColor = ShipLabel.ColumnColors[i % 2];\r
+ label.BackColor = CustomColors.ColumnColors.DarkFirst(i);\r
}\r
Controls.Add(panel);\r
}\r
}\r
});\r
// ReSharper disable once VirtualMemberCallInConstructor\r
- BackColor = ShipLabel.ColumnColors[1];\r
+ BackColor = CustomColors.ColumnColors.Bright;\r
}\r
\r
public void SetInformation(BattleInfo battleInfo)\r
-using System.Drawing;\r
+// Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+using System.Drawing;\r
\r
namespace KancolleSniffer.View\r
{\r
public static class CustomColors\r
{\r
public static Color ActiveButtonColor = Color.FromArgb(152, 179, 208);\r
+\r
+ public class ColumnColors\r
+ {\r
+ public static readonly Color Bright = Color.White;\r
+ private static readonly Color Dark = SystemColors.Control;\r
+ private static readonly Color[] Colors = {Bright, Dark};\r
+\r
+ public static Color BrightFirst(int i) => Colors[i % 2];\r
+ public static Color DarkFirst(int i) => Colors[(i + 1) % 2];\r
+ }\r
}\r
}
\ No newline at end of file
{\r
Location = new Point(0, y),\r
Size = new Size(ListForm.PanelWidth, LineHeight),\r
- BackColor = ShipLabel.ColumnColors[(i + 1) % 2],\r
+ BackColor = CustomColors.ColumnColors.BrightFirst(i),\r
Visible = false\r
};\r
Scaler.Scale(lbp);\r
foreach (var label in labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
}\r
\r
foreach (var label in headings)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[1];\r
+ label.BackColor = CustomColors.ColumnColors.Bright;\r
}\r
for (var i = 0; i < shipLabels.Length; i++)\r
{\r
foreach (var label in shipLabels[i])\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[i % 2];\r
+ label.BackColor = CustomColors.ColumnColors.DarkFirst(i);\r
label.Tag = i;\r
label.Click += onClick;\r
}\r
foreach (var label in headings)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[1];\r
+ label.BackColor = CustomColors.ColumnColors.Bright;\r
}\r
for (var i = 0; i < _combinedLabels.Length; i++)\r
{\r
foreach (var label in _combinedLabels[i])\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[i % 2];\r
+ label.BackColor = CustomColors.ColumnColors.DarkFirst(i);\r
label.Tag = i;\r
label.Click += onClick;\r
}\r
Size = new Size(31, 12),\r
TextAlign = ContentAlignment.TopRight\r
});\r
- label.BackColor = ShipLabel.ColumnColors[i % 2];\r
+ label.BackColor = CustomColors.ColumnColors.DarkFirst(i);\r
}\r
foreach (var label in timerLabels)\r
Scaler.Scale(label);\r
foreach (var label in _repairLabels[i].Labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
label.Click += onClick;\r
}\r
}\r
labels.Fleet.Text = "";\r
labels.Name.SetName("");\r
labels.Time.Text = "";\r
- labels.Damage.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ labels.Damage.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
}\r
}
\ No newline at end of file
[DesignerCategory("Code")]\r
public class ShipLabel : Label\r
{\r
- public static Color[] ColumnColors = {SystemColors.Control, Color.White};\r
public static Font LatinFont { get; set; } = new Font("Tahoma", 8f);\r
public bool AnchorRight { get; set; }\r
private Color _initialBackColor;\r
{\r
Location = new Point(0, y),\r
Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),\r
- BackColor = ShipLabel.ColumnColors[(i + 1) % 2]\r
+ BackColor = CustomColors.ColumnColors.BrightFirst(i)\r
};\r
Scaler.Scale(panel);\r
panel.Tag = panel.Location.Y;\r
foreach (var label in labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
}\r
\r
{\r
Location = new Point(0, y),\r
Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),\r
- BackColor = ShipLabel.ColumnColors[(i + 1) % 2]\r
+ BackColor = CustomColors.ColumnColors.BrightFirst(i)\r
};\r
Scaler.Scale(panel);\r
panel.Tag = panel.Location.Y;\r
foreach (var label in labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
_shipListPanel.SetHpPercent(labels[0]);\r
}\r
{\r
Location = new Point(0, y),\r
Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),\r
- BackColor = ShipLabel.ColumnColors[(i + 1) % 2]\r
+ BackColor = CustomColors.ColumnColors.BrightFirst(i)\r
};\r
Scaler.Scale(panel);\r
var labels = new[]\r
foreach (var label in labels)\r
{\r
Scaler.Scale(label);\r
- label.BackColor = ShipLabel.ColumnColors[(i + 1) % 2];\r
+ label.BackColor = CustomColors.ColumnColors.BrightFirst(i);\r
}\r
_shipListPanel.SetHpPercent(labels[0]);\r
}\r