OSDN Git Service

ツールチップをズームする
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Tue, 20 Mar 2018 12:51:32 +0000 (21:51 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Wed, 21 Mar 2018 08:52:28 +0000 (17:52 +0900)
12 files changed:
KancolleSniffer/AirBattleResultPanel.cs
KancolleSniffer/BattleResultPanel.cs
KancolleSniffer/ConfigDialog.Designer.cs
KancolleSniffer/ConfigDialog.cs
KancolleSniffer/ConfigDialog.resx
KancolleSniffer/FleetPanel.cs
KancolleSniffer/KancolleSniffer.csproj
KancolleSniffer/MainForm.Designer.cs
KancolleSniffer/MainForm.cs
KancolleSniffer/MainForm.resx
KancolleSniffer/NotificationConfigDialog.cs
KancolleSniffer/ResizableToolTip.cs [new file with mode: 0644]

index 6a445f7..7212d05 100644 (file)
@@ -56,7 +56,7 @@ namespace KancolleSniffer
         private int _resultIndex;\r
         private readonly ShipLabel _ciShipName;\r
         private readonly Label _ciKind;\r
-        private readonly ToolTip _toolTip = new ToolTip{ShowAlways = true};\r
+        private readonly ResizableToolTip _toolTip = new ResizableToolTip{ShowAlways = true};\r
 \r
         public bool ShowResultAutomatic { get; set; }\r
 \r
@@ -214,5 +214,12 @@ namespace KancolleSniffer
             _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
+        }\r
     }\r
 }
\ No newline at end of file
index f3adfed..93a32d1 100644 (file)
@@ -30,7 +30,7 @@ namespace KancolleSniffer
         private readonly List<Panel> _panelList = new List<Panel>();\r
         private bool _hpPercent;\r
         private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();\r
-        private readonly ToolTip _toolTip = new ToolTip {ShowAlways = true};\r
+        private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
         private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];\r
         private Label _phaseLabel, _rankLabel;\r
         private BattleState _prevBattleState;\r
@@ -329,11 +329,18 @@ namespace KancolleSniffer
             }\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
         {\r
             private readonly Label[] _formation;\r
             private readonly Label[] _fighterPower;\r
-            private readonly ToolTip _toolTip = new ToolTip {ShowAlways = true};\r
+            private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
 \r
             public InformationPanel()\r
             {\r
@@ -437,6 +444,13 @@ namespace KancolleSniffer
                         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
index 07e3f88..5827649 100644 (file)
@@ -42,7 +42,6 @@ namespace KancolleSniffer
         /// </summary>\r
         private void InitializeComponent()\r
         {\r
-            this.components = new System.ComponentModel.Container();\r
             this.tabControl = new System.Windows.Forms.TabControl();\r
             this.tabPageWindow = new System.Windows.Forms.TabPage();\r
             this.checkBoxLocationPerMachine = new System.Windows.Forms.CheckBox();\r
@@ -131,7 +130,6 @@ namespace KancolleSniffer
             this.buttonCancel = new System.Windows.Forms.Button();\r
             this.buttonOk = new System.Windows.Forms.Button();\r
             this.openSoundFileDialog = new System.Windows.Forms.OpenFileDialog();\r
-            this.toolTipError = new System.Windows.Forms.ToolTip(this.components);\r
             this.folderBrowserDialogOutputDir = new System.Windows.Forms.FolderBrowserDialog();\r
             this.openDebugLogDialog = new System.Windows.Forms.OpenFileDialog();\r
             this.tabControl.SuspendLayout();\r
@@ -1088,12 +1086,6 @@ namespace KancolleSniffer
     ";*.wma;*.mp2;*.mp3";\r
             this.openSoundFileDialog.Title = "オーディオファイルを選択する";\r
             // \r
-            // toolTipError\r
-            // \r
-            this.toolTipError.AutomaticDelay = 0;\r
-            this.toolTipError.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Error;\r
-            this.toolTipError.ToolTipTitle = "入力エラー";\r
-            // \r
             // folderBrowserDialogOutputDir\r
             // \r
             this.folderBrowserDialogOutputDir.Description = "報告書の出力先を指定します。";\r
@@ -1206,7 +1198,6 @@ namespace KancolleSniffer
         private System.Windows.Forms.RadioButton radioButtonAutoConfigOn;\r
         private System.Windows.Forms.TextBox textBoxListen;\r
         private System.Windows.Forms.Label labelListen;\r
-        private System.Windows.Forms.ToolTip toolTipError;\r
         private System.Windows.Forms.TabPage tabPageLog;\r
         private System.Windows.Forms.Label label10;\r
         private System.Windows.Forms.CheckBox checkBoxOutput;\r
index b19c302..1ec5f9c 100644 (file)
@@ -310,15 +310,18 @@ namespace KancolleSniffer
             return true;\r
         }\r
 \r
+        private readonly ResizableToolTip _toolTip =\r
+            new ResizableToolTip {AutomaticDelay = 0, ToolTipIcon = ToolTipIcon.Error};\r
+\r
         private void ShowToolTip(string message, Control control)\r
         {\r
             tabControl.SelectedTab = (TabPage)control.Parent.Parent;\r
-            toolTipError.Show(message, control, 0, control.Height, 3000);\r
+            _toolTip.Show(message, control, 0, control.Height, 3000);\r
         }\r
 \r
         private void textBox_Enter(object sender, EventArgs e)\r
         {\r
-            toolTipError.Hide((Control)sender);\r
+            _toolTip.Hide((Control)sender);\r
         }\r
 \r
         private void buttonDebugLogOpenFile_Click(object sender, EventArgs e)\r
@@ -370,5 +373,12 @@ namespace KancolleSniffer
                 MessageBox.Show(this, ex.Message, "Pushoverエラー", MessageBoxButtons.OK, MessageBoxIcon.Error);\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
 }
\ No newline at end of file
index dfa338c..74e035f 100644 (file)
   <metadata name="openSoundFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>17, 17</value>\r
   </metadata>\r
-  <metadata name="toolTipError.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>156, 17</value>\r
-  </metadata>\r
   <metadata name="folderBrowserDialogOutputDir.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>279, 17</value>\r
   </metadata>\r
index 4eaada5..06b9302 100644 (file)
@@ -28,7 +28,7 @@ namespace KancolleSniffer
         private Record[] _table;\r
         private readonly List<FleetLabels> _labelList = new List<FleetLabels>();\r
         private readonly List<Panel> _panelList = new List<Panel>();\r
-        private readonly ToolTip _toolTip = new ToolTip {ShowAlways = true};\r
+        private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
 \r
         private class Record\r
         {\r
@@ -324,5 +324,12 @@ namespace KancolleSniffer
             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
index f6912f6..4583c24 100644 (file)
     <Compile Include="Properties\AssemblyInfo.cs" />\r
     <Compile Include="QuestInfo.cs" />\r
     <Compile Include="ConditionTimer.cs" />\r
+    <Compile Include="ResizableToolTip.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
     <Compile Include="ShipInfo.cs" />\r
     <Compile Include="ShipLabel.cs" />\r
     <Compile Include="ShipListPanel.cs">\r
index 4659665..a54054b 100644 (file)
@@ -167,12 +167,9 @@ namespace KancolleSniffer
             this.labelFuelSq3 = new System.Windows.Forms.Label();\r
             this.labelBullSq4 = new System.Windows.Forms.Label();\r
             this.labelFuelSq4 = new System.Windows.Forms.Label();\r
-            this.toolTipAchievement = new System.Windows.Forms.ToolTip(this.components);\r
             this.labelAkashiRepair = new System.Windows.Forms.Label();\r
-            this.toolTipFighterPower = new System.Windows.Forms.ToolTip(this.components);\r
-            this.toolTipLoS = new System.Windows.Forms.ToolTip(this.components);\r
-            this.panelRepairList = new KancolleSniffer.RepairListForMain();\r
             this.labelClearQuest = new System.Windows.Forms.Label();\r
+            this.panelRepairList = new KancolleSniffer.RepairListForMain();\r
             this.panelHeadquarters.SuspendLayout();\r
             this.panelShipInfo.SuspendLayout();\r
             this.panelBattleInfo.SuspendLayout();\r
@@ -1352,10 +1349,6 @@ namespace KancolleSniffer
             this.labelFuelSq4.Size = new System.Drawing.Size(8, 13);\r
             this.labelFuelSq4.TabIndex = 52;\r
             // \r
-            // toolTipAchievement\r
-            // \r
-            this.toolTipAchievement.ShowAlways = true;\r
-            // \r
             // labelAkashiRepair\r
             // \r
             this.labelAkashiRepair.AutoSize = true;\r
@@ -1365,24 +1358,6 @@ namespace KancolleSniffer
             this.labelAkashiRepair.TabIndex = 54;\r
             this.labelAkashiRepair.Text = "修理";\r
             // \r
-            // toolTipFighterPower\r
-            // \r
-            this.toolTipFighterPower.ShowAlways = true;\r
-            // \r
-            // toolTipLoS\r
-            // \r
-            this.toolTipLoS.ShowAlways = true;\r
-            // \r
-            // panelRepairList\r
-            // \r
-            this.panelRepairList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
-            this.panelRepairList.Location = new System.Drawing.Point(6, 207);\r
-            this.panelRepairList.Name = "panelRepairList";\r
-            this.panelRepairList.Size = new System.Drawing.Size(129, 21);\r
-            this.panelRepairList.TabIndex = 4;\r
-            this.panelRepairList.Visible = false;\r
-            this.panelRepairList.Click += new System.EventHandler(this.panelRepairList_Click);\r
-            // \r
             // labelClearQuest\r
             // \r
             this.labelClearQuest.AutoSize = true;\r
@@ -1396,6 +1371,16 @@ namespace KancolleSniffer
             this.labelClearQuest.MouseDown += new System.Windows.Forms.MouseEventHandler(this.labelClearQuest_MouseDown);\r
             this.labelClearQuest.MouseUp += new System.Windows.Forms.MouseEventHandler(this.labelClearQuest_MouseUp);\r
             // \r
+            // panelRepairList\r
+            // \r
+            this.panelRepairList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+            this.panelRepairList.Location = new System.Drawing.Point(6, 207);\r
+            this.panelRepairList.Name = "panelRepairList";\r
+            this.panelRepairList.Size = new System.Drawing.Size(129, 21);\r
+            this.panelRepairList.TabIndex = 4;\r
+            this.panelRepairList.Visible = false;\r
+            this.panelRepairList.Click += new System.EventHandler(this.panelRepairList_Click);\r
+            // \r
             // MainForm\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
@@ -1575,7 +1560,6 @@ namespace KancolleSniffer
         private System.Windows.Forms.Label labelBullSq4;\r
         private System.Windows.Forms.Label labelFuelSq4;\r
         private System.Windows.Forms.ToolStripMenuItem LogToolStripMenuItem;\r
-        private System.Windows.Forms.ToolTip toolTipAchievement;\r
         private System.Windows.Forms.Label labelProgress6;\r
         private System.Windows.Forms.Label labelQuest6;\r
         private System.Windows.Forms.Label labelQuestColor1;\r
@@ -1589,8 +1573,6 @@ namespace KancolleSniffer
         private System.Windows.Forms.Panel panelCombinedFleet;\r
         private System.Windows.Forms.Label labelAkashiRepair;\r
         private System.Windows.Forms.Label labelPresetAkashiTimer;\r
-        private System.Windows.Forms.ToolTip toolTipFighterPower;\r
-        private System.Windows.Forms.ToolTip toolTipLoS;\r
         private RepairListForMain panelRepairList;\r
         private System.Windows.Forms.Panel panel7Ships;\r
         private System.Windows.Forms.LinkLabel linkLabelGuide;\r
index 6a2f36f..b56bf69 100644 (file)
@@ -36,9 +36,9 @@ namespace KancolleSniffer
         private readonly Config _config = new Config();\r
         private readonly ConfigDialog _configDialog;\r
         private readonly ProxyManager _proxyManager;\r
-        private readonly ToolTip _toolTipQuest = new ToolTip {ShowAlways = true, AutoPopDelay = 10000};\r
-        private readonly ToolTip _toolTipCount = new ToolTip {ShowAlways = true};\r
-        private readonly ToolTip _tooltipCopy = new ToolTip {AutomaticDelay = 0};\r
+        private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
+        private readonly ResizableToolTip _toolTipQuest = new ResizableToolTip {ShowAlways = true, AutoPopDelay = 10000};\r
+        private readonly ResizableToolTip _tooltipCopy = new ResizableToolTip {AutomaticDelay = 0};\r
         private int _currentFleet;\r
         private bool _combinedFleet;\r
         private readonly Label[] _labelCheckFleets;\r
@@ -414,6 +414,10 @@ namespace KancolleSniffer
             {\r
                 control.Font = new Font(control.Font.FontFamily, control.Font.Size * _config.Zoom / 100);\r
             }\r
+            foreach (var toolTip in new[]{_toolTip, _toolTipQuest, _tooltipCopy})\r
+            {\r
+                toolTip.Font = new Font(toolTip.Font.FontFamily, toolTip.Font.Size * _config.Zoom / 100);\r
+            }\r
             ShipLabel.LatinFont = new Font("Tahoma", 8f * _config.Zoom / 100);\r
             var cur = CurrentAutoScaleDimensions;\r
             ShipLabel.ScaleFactor = new SizeF(ShipLabel.ScaleFactor.Width * cur.Width / prev.Width,\r
@@ -538,7 +542,7 @@ namespace KancolleSniffer
             if (ac >= 10000)\r
                 ac = 9999;\r
             labelAchievement.Text = ac >= 1000 ? ((int)ac).ToString("D") : ac.ToString("F1");\r
-            toolTipAchievement.SetToolTip(labelAchievement,\r
+            _toolTip.SetToolTip(labelAchievement,\r
                 "今月 " + _sniffer.Achievement.ValueOfMonth.ToString("F1") + "\n" +\r
                 "EO " + _sniffer.ExMap.Achievement);\r
             UpdateMaterialHistry();\r
@@ -674,8 +678,8 @@ namespace KancolleSniffer
                 : _sniffer.GetContactTriggerRate(_currentFleet);\r
             var text = "制空: " + (fp[0] == fp[1] ? $"{fp[0]}" : $"{fp[0]}~{fp[1]}") +\r
                        $" 触接: {cr * 100:f1}";\r
-            toolTipFighterPower.SetToolTip(labelFighterPower, text);\r
-            toolTipFighterPower.SetToolTip(labelFighterPowerCaption, text);\r
+            _toolTip.SetToolTip(labelFighterPower, text);\r
+            _toolTip.SetToolTip(labelFighterPowerCaption, text);\r
         }\r
 \r
         private void UpdateLoS()\r
@@ -683,8 +687,8 @@ namespace KancolleSniffer
             labelLoS.Text = RoundDown(_sniffer.GetFleetLineOfSights(_currentFleet, 1)).ToString("F1");\r
             var text = $"係数3: {RoundDown(_sniffer.GetFleetLineOfSights(_currentFleet, 3)):F1}\r\n" +\r
                        $"係数4: {RoundDown(_sniffer.GetFleetLineOfSights(_currentFleet, 4)):F1}";\r
-            toolTipLoS.SetToolTip(labelLoS, text);\r
-            toolTipLoS.SetToolTip(labelLoSCaption, text);\r
+            _toolTip.SetToolTip(labelLoS, text);\r
+            _toolTip.SetToolTip(labelLoSCaption, text);\r
         }\r
 \r
         private double RoundDown(double number)\r
@@ -725,8 +729,8 @@ namespace KancolleSniffer
             if (power.AirCombat != power.Interception)\r
             {\r
                 var text = "防空: " + power.Interception + power.UnknownMark;\r
-                toolTipFighterPower.SetToolTip(labelEnemyFighterPower, text);\r
-                toolTipFighterPower.SetToolTip(labelEnemyFighterPowerCaption, text);\r
+                _toolTip.SetToolTip(labelEnemyFighterPower, text);\r
+                _toolTip.SetToolTip(labelEnemyFighterPowerCaption, text);\r
             }\r
             UpdateFighterPower(_sniffer.CombinedFleetType > 0 && battle.EnemyIsCombined);\r
             labelFighterPower.ForeColor = new[]\r
@@ -1023,19 +1027,19 @@ namespace KancolleSniffer
                     {\r
                         count[i].Text = "";\r
                         count[i].ForeColor = Color.Black;\r
-                        _toolTipCount.SetToolTip(count[i], "");\r
+                        _toolTip.SetToolTip(count[i], "");\r
                         continue;\r
                     }\r
                     count[i].Text = " " + c;\r
                     count[i].ForeColor = c.Cleared ? CUDColor.Green : Color.Black;\r
-                    _toolTipCount.SetToolTip(count[i], c.ToToolTip());\r
+                    _toolTip.SetToolTip(count[i], c.ToToolTip());\r
                 }\r
                 else\r
                 {\r
                     category[i].BackColor = DefaultBackColor;\r
                     name[i].Text = count[i].Text = progress[i].Text = "";\r
                     _toolTipQuest.SetToolTip(name[i], "");\r
-                    _toolTipCount.SetToolTip(count[i], "");\r
+                    _toolTip.SetToolTip(count[i], "");\r
                 }\r
             }\r
         }\r
index 6329c2f..af40494 100644 (file)
         AsMB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/A4EB/wPDCw==\r
 </value>\r
   </data>\r
-  <metadata name="toolTipAchievement.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>1092, 26</value>\r
-  </metadata>\r
-  <metadata name="toolTipFighterPower.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>17, 39</value>\r
-  </metadata>\r
-  <metadata name="toolTipLoS.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>189, 39</value>\r
-  </metadata>\r
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
         AAABAAQAQEAAAAEAIAAoQAAARgAAACAgAAABACAAKBAAAG5AAAAYGAAAAQAgACgJAACWUAAAEBAAAAEA\r
index a4b10e9..dc8e9bd 100644 (file)
@@ -1,5 +1,6 @@
 using System;\r
 using System.Collections.Generic;\r
+using System.Drawing;\r
 using System.Linq;\r
 using System.Windows.Forms;\r
 \r
@@ -9,7 +10,7 @@ namespace KancolleSniffer
     {\r
         private readonly Dictionary<string, NotificationSpec> _notifications;\r
         private readonly Dictionary<NotificationType, CheckBox> _configCheckBoxs;\r
-        private readonly ToolTip _tooltip = new ToolTip();\r
+        private readonly ResizableToolTip _toolTip = new ResizableToolTip();\r
 \r
         public NotificationConfigDialog(Dictionary<string, NotificationSpec> notifications,\r
             Dictionary<NotificationType, CheckBox> checkBoxs)\r
@@ -59,7 +60,7 @@ namespace KancolleSniffer
             checkBoxPlaySound.Checked = (notification.Flags & NotificationType.PlaySound) != 0;\r
             checkBoxPush.Checked = (notification.Flags & NotificationType.Push) != 0;\r
             checkBoxRepeat.Checked = (notification.Flags & NotificationType.Repeat) != 0;\r
-            _tooltip.SetToolTip(checkBoxCont,\r
+            _toolTip.SetToolTip(checkBoxCont,\r
                 !IsContAvailable ? "" :\r
                 notification.Name == "遠征終了" ? "再度遠征に出すまでリピートする。" : "再度入渠させるまでリピートする。");\r
             checkBoxCont.Checked = (notification.Flags & NotificationType.Cont) != 0;\r
@@ -112,5 +113,12 @@ namespace KancolleSniffer
             _notifications[(string)listBoxNotifications.SelectedItem].PreliminaryPeriod =\r
                 int.TryParse(textBoxPreliminary.Text, out int preliminary) ? preliminary : 0;\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
diff --git a/KancolleSniffer/ResizableToolTip.cs b/KancolleSniffer/ResizableToolTip.cs
new file mode 100644 (file)
index 0000000..be682bd
--- /dev/null
@@ -0,0 +1,81 @@
+// 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;\r
+using System.Drawing;\r
+using System.Runtime.InteropServices;\r
+using System.Windows.Forms;\r
+\r
+namespace KancolleSniffer\r
+{\r
+    public class ResizableToolTip : ToolTip\r
+    {\r
+        private const TextFormatFlags TfFlags =\r
+            TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.NoPrefix;\r
+\r
+        private readonly Brush _backBrush;\r
+        private Size _padding;\r
+        private int _iconSize;\r
+        private int _iconPadding;\r
+\r
+        public Font Font { get; set; }\r
+\r
+        public ResizableToolTip()\r
+        {\r
+            OwnerDraw = true;\r
+            Font = SystemFonts.StatusFont;\r
+            Popup += OnPopup;\r
+            Draw += OnDraw;\r
+            DwmIsCompositionEnabled(out var aero);\r
+            _backBrush = new SolidBrush(aero ? Color.White : BackColor);\r
+        }\r
+\r
+        private void OnPopup(object sender, PopupEventArgs e)\r
+        {\r
+            if (ToolTipIcon == ToolTipIcon.Error)\r
+            {\r
+                _iconSize = 16;\r
+                _iconPadding = (int)Math.Round((Font.Height - _iconSize) / 2.0);\r
+            }\r
+            _padding = new Size((int)Math.Round(Font.Height * 0.2), (int)Math.Round(Font.Height * 0.15));\r
+            using (var g = Graphics.FromHwnd(e.AssociatedWindow.Handle))\r
+            {\r
+                var size = TextRenderer.MeasureText(g, GetToolTip(e.AssociatedControl), Font,\r
+                    new Size(int.MaxValue, int.MaxValue), TfFlags);\r
+                e.ToolTipSize = new Size(size.Width + _padding.Width * 2 + _iconSize,\r
+                    size.Height + _padding.Height * 2);\r
+            }\r
+        }\r
+\r
+        private void OnDraw(object sender, DrawToolTipEventArgs e)\r
+        {\r
+            e.Graphics.FillRectangle(_backBrush, e.Bounds);\r
+            e.Graphics.DrawRectangle(SystemPens.ControlDarkDark,\r
+                new Rectangle(e.Bounds.Location, new Size(e.Bounds.Width - 1, e.Bounds.Height - 1)));\r
+            TextRenderer.DrawText(e.Graphics, e.ToolTipText, Font,\r
+                new Rectangle(e.Bounds.X + _padding.Width + _iconSize,\r
+                    e.Bounds.Y + _padding.Height, e.Bounds.Width - _padding.Width * 2,\r
+                    e.Bounds.Height - _padding.Height * 2),\r
+                Color.Black, TfFlags);\r
+            if (ToolTipIcon != ToolTipIcon.Error)\r
+                return;\r
+            e.Graphics.DrawIcon(SystemIcons.Error,\r
+                new Rectangle(e.Bounds.X + _padding.Width + _iconPadding,\r
+                    e.Bounds.Y + _padding.Height + _iconPadding, _iconSize, _iconSize));\r
+        }\r
+\r
+        [DllImport("dwmapi.dll")]\r
+        private static extern IntPtr DwmIsCompositionEnabled(out bool pfEnabled);\r
+    }\r
+}
\ No newline at end of file