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
_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
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
}\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
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
/// </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
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
";*.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
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
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
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
<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
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
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
<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
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
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
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
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
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
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
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
{\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
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
: _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
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
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
{\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
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
using System;\r
using System.Collections.Generic;\r
+using System.Drawing;\r
using System.Linq;\r
using System.Windows.Forms;\r
\r
{\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
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
_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
--- /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;\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