From 82fee7a15d13974f129423332b3e24b5e477ed0a Mon Sep 17 00:00:00 2001 From: Izakbar Date: Sat, 16 Nov 2024 10:28:49 +0000 Subject: [PATCH] #31 resize mainform based on actual control tabitem size - may fix issues on chinese systems --- .../View/Implementation/MainForm.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Eve-O-Preview/View/Implementation/MainForm.cs b/src/Eve-O-Preview/View/Implementation/MainForm.cs index a5a6d08..ac36e3b 100644 --- a/src/Eve-O-Preview/View/Implementation/MainForm.cs +++ b/src/Eve-O-Preview/View/Implementation/MainForm.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; namespace EveOPreview.View @@ -34,6 +35,7 @@ namespace EveOPreview.View this.InitZoomAnchorMap(); this.InitOverlayLabelMap(); + this.InitFormSize(); } public bool MinimizeToTray @@ -498,5 +500,20 @@ namespace EveOPreview.View this._overlayLabelMap[ViewZoomAnchor.S] = this.OverlayLabelSRadioButton; this._overlayLabelMap[ViewZoomAnchor.SE] = this.OverlayLabelSERadioButton; } + private void InitFormSize() + { + const int BUFFER_PIXEL_AMOUNT = 8; + // resize form height based on tabbed control item height + var tabControl = (System.Windows.Forms.TabControl)this.Controls.Find("ContentTabControl", false).First(); + if (tabControl != null) + { + var furnitureSize = this.Height - tabControl.Height; + var calculatedHeight = (tabControl.ItemSize.Width * tabControl.Controls.Count) + furnitureSize + BUFFER_PIXEL_AMOUNT; + if (this.Height < calculatedHeight) + { + this.Height = calculatedHeight; + } + } + } } } \ No newline at end of file