<Compile Include="Model\PresetDeck.cs" />\r
<Compile Include="Net\ProxyManager.cs" />\r
<Compile Include="Net\PushNotification.cs" />\r
+ <Compile Include="View\PanelWithToolTip.cs">\r
+ <SubType>Component</SubType>\r
+ </Compile>\r
<Compile Include="View\RepairListForMain.cs">\r
<SubType>Component</SubType>\r
</Compile>\r
}\r
\r
[DesignerCategory("Code")]\r
- public class AirBattleResultPanel : Panel\r
+ public class AirBattleResultPanel : PanelWithToolTip\r
{\r
private readonly Label _phaseName;\r
private readonly Label _stage1;\r
private int _resultIndex;\r
private readonly ShipLabel _ciShipName;\r
private readonly Label _ciKind;\r
- private readonly ResizableToolTip _toolTip = new ResizableToolTip{ShowAlways = true};\r
\r
public bool ShowResultAutomatic { get; set; }\r
\r
{\r
_ciShipName.SetName(null);\r
_ciKind.Text = "";\r
- _toolTip.SetToolTip(_ciKind, "");\r
+ ToolTip.SetToolTip(_ciKind, "");\r
}\r
else\r
{\r
_ciShipName.SetName(result.AirFire.ShipName, ShipNameWidth.CiShipName);\r
_ciKind.Text = result.AirFire.Kind.ToString();\r
- _toolTip.SetToolTip(_ciKind, string.Join("\r\n", result.AirFire.Items));\r
+ ToolTip.SetToolTip(_ciKind, string.Join("\r\n", result.AirFire.Items));\r
}\r
}\r
\r
}\r
_ciShipName.SetName(null);\r
_ciKind.Text = "";\r
- _toolTip.SetToolTip(_ciKind, "");\r
- }\r
-\r
- protected override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
- {\r
- base.ScaleControl(factor, specified);\r
- if (factor.Height > 1)\r
- _toolTip.Font = new Font(_toolTip.Font.FontFamily, _toolTip.Font.Size * factor.Height);\r
+ ToolTip.SetToolTip(_ciKind, "");\r
}\r
}\r
}
\ No newline at end of file
\r
namespace KancolleSniffer.View\r
{\r
- public class BattleResultPanel : Panel\r
+ public class BattleResultPanel : PanelWithToolTip\r
{\r
private const int LineHeight = 16;\r
private readonly List<ShipLabel[]> _friendLabels = new List<ShipLabel[]>();\r
private readonly List<ShipLabel[]> _enemyLabels = new List<ShipLabel[]>();\r
private readonly List<Panel> _panelList = new List<Panel>();\r
private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();\r
- private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];\r
private Label _phaseLabel, _rankLabel, _cellLabel;\r
private readonly BattleResultRank[] _rank = new BattleResultRank[2];\r
var ship = friend.Main[i];\r
labels[0].SetHp(ship);\r
labels[1].SetName(ship, ShipNameWidth.BattleResult);\r
- _toolTip.SetToolTip(labels[1], GetEquipString(ship));\r
+ ToolTip.SetToolTip(labels[1], GetEquipString(ship));\r
}\r
if (friend.Guard.Length > 0)\r
{\r
var ship = friend.Guard[i];\r
labels[0].SetHp(ship);\r
labels[1].SetName(ship, ShipNameWidth.BattleResult);\r
- _toolTip.SetToolTip(labels[1], GetEquipString(ship));\r
+ ToolTip.SetToolTip(labels[1], GetEquipString(ship));\r
}\r
}\r
var friendLines = friend.Main.Length + (friend.Guard.Length > 0 ? friend.Guard.Length + 1 : 0);\r
var ship = enemy.Main[i];\r
labels[0].SetHp(ship);\r
labels[1].SetName(ShortenName(ship.Name));\r
- _toolTip.SetToolTip(labels[1], GetEquipString(ship));\r
+ ToolTip.SetToolTip(labels[1], GetEquipString(ship));\r
}\r
if (enemy.Guard.Length > 0)\r
{\r
var ship = enemy.Guard[i];\r
labels[0].SetHp(ship);\r
labels[1].SetName(ShortenName(ship.Name));\r
- _toolTip.SetToolTip(labels[1], GetEquipString(ship));\r
+ ToolTip.SetToolTip(labels[1], GetEquipString(ship));\r
}\r
}\r
var enemyLines = enemy.Main.Length + (enemy.Guard.Length > 0 ? enemy.Guard.Length + 1 : 0);\r
base.OnMouseWheel(e);\r
}\r
\r
- protected override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
- {\r
- base.ScaleControl(factor, specified);\r
- if (factor.Height > 1)\r
- _toolTip.Font = new Font(_toolTip.Font.FontFamily, _toolTip.Font.Size * factor.Height);\r
- }\r
-\r
- private class InformationPanel : Panel\r
+ private class InformationPanel : PanelWithToolTip\r
{\r
private readonly Label[] _formation;\r
private readonly Label[] _fighterPower;\r
- private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
\r
public InformationPanel()\r
{\r
}\r
var fp = battleInfo.FighterPower;\r
_fighterPower[0].Text = fp[0].ToString("D");\r
- _toolTip.SetToolTip(_fighterPower[0], fp[0] == fp[1] ? "" : $"{fp[0]}~{fp[1]}");\r
+ ToolTip.SetToolTip(_fighterPower[0], fp[0] == fp[1] ? "" : $"{fp[0]}~{fp[1]}");\r
var efp = battleInfo.EnemyFighterPower;\r
_fighterPower[1].Text = efp.AirCombat + efp.UnknownMark;\r
- _toolTip.SetToolTip(_fighterPower[1],\r
+ ToolTip.SetToolTip(_fighterPower[1],\r
efp.AirCombat == efp.Interception ? "" : "防空:" + efp.Interception + efp.UnknownMark);\r
_fighterPower[2].Text =\r
new[] {"", "制空均衡", "制空確保", "航空優勢", "航空劣勢", "制空喪失"}[battleInfo.AirControlLevel + 1];\r
return "";\r
}\r
}\r
-\r
- protected override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
- {\r
- base.ScaleControl(factor, specified);\r
- if (factor.Height > 1)\r
- _toolTip.Font = new Font(_toolTip.Font.FontFamily, _toolTip.Font.Size * factor.Height);\r
- }\r
}\r
}\r
}
\ No newline at end of file
\r
namespace KancolleSniffer.View\r
{\r
- public class FleetPanel : Panel\r
+ public class FleetPanel : PanelWithToolTip\r
{\r
private const int LineHeight = 14;\r
private const int LabelHeight = 12;\r
private Record[] _table = new Record[0];\r
private readonly List<FleetLabels> _labelList = new List<FleetLabels>();\r
private readonly List<Panel> _panelList = new List<Panel>();\r
- private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true, AutoPopDelay = 10000};\r
+\r
+ public FleetPanel()\r
+ {\r
+ ToolTip.AutoPopDelay = 10000;\r
+ }\r
\r
public class Record\r
{\r
labels.Fleet.Text = e.Fleet;\r
labels.Name.SetName(e.Ship);\r
if (e.Ship2 != "")\r
- _toolTip.SetToolTip(labels.Name, e.Ship2);\r
+ ToolTip.SetToolTip(labels.Name, e.Ship2);\r
labels.Equip.Text = e.Equip;\r
labels.EquipColor.Visible = e.Equip != "";\r
labels.EquipColor.BackColor = e.Color;\r
labels.Spec.Text = e.Spec;\r
if (e.Fleet != "" && e.Fleet2 != "")\r
- _toolTip.SetToolTip(labels.Fleet, e.Fleet2);\r
- _toolTip.SetToolTip(labels.Equip, e.AircraftSpec != "" ? e.AircraftSpec : "");\r
- _toolTip.SetToolTip(labels.Spec, e.Spec2 != "" ? e.Spec2 : "");\r
+ ToolTip.SetToolTip(labels.Fleet, e.Fleet2);\r
+ ToolTip.SetToolTip(labels.Equip, e.AircraftSpec != "" ? e.AircraftSpec : "");\r
+ ToolTip.SetToolTip(labels.Spec, e.Spec2 != "" ? e.Spec2 : "");\r
lbp.Visible = true;\r
}\r
\r
var y = (int)Math.Round(ShipLabel.ScaleFactor.Height * LineHeight * i);\r
AutoScrollPosition = new Point(0, y);\r
}\r
-\r
- protected override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
- {\r
- base.ScaleControl(factor, specified);\r
- if (factor.Height > 1)\r
- _toolTip.Font = new Font(_toolTip.Font.FontFamily, _toolTip.Font.Size * factor.Height);\r
- }\r
}\r
}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2018 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
+using System.Windows.Forms;\r
+\r
+namespace KancolleSniffer.View\r
+{\r
+ public class PanelWithToolTip : Panel\r
+ {\r
+ protected ResizableToolTip ToolTip { get; } = new ResizableToolTip(){ShowAlways = true};\r
+\r
+ protected sealed override void ScaleControl(SizeF factor, BoundsSpecified specified)\r
+ {\r
+ base.ScaleControl(factor, specified);\r
+ if (Font.Height != DefaultFont.Height)\r
+ ToolTip.Font = new Font(ToolTip.Font.FontFamily, ToolTip.Font.Size * factor.Height);\r
+ }\r
+ }\r
+}
\ No newline at end of file