From 123bece791cc2fa0f7d70c5e7c31d3421e7b3d1b Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sun, 7 Aug 2022 17:49:42 +0200 Subject: [PATCH] [Feature] Adjust width when items deleted (#431), version 1.3.0.17 --- Properties/AssemblyInfo.cs | 4 ++-- UserInterface/Menu.cs | 5 ++--- Utilities/DataGridViewExtensions.cs | 7 ++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 3606ce1..9c099be 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.16")] -[assembly: AssemblyFileVersion("1.3.0.16")] +[assembly: AssemblyVersion("1.3.0.17")] +[assembly: AssemblyFileVersion("1.3.0.17")] diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index a38dfcc..9042cab 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -386,10 +386,9 @@ namespace SystemTrayMenu.UserInterface if (!Config.ShowSearchBar) { - tableLayoutPanelSearch.AutoSize = false; - tableLayoutPanelSearch.Height = 0; textBoxSearch.AutoSize = false; - textBoxSearch.Height = 0; + textBoxSearch.Size = new Size(0, 0); + textBoxSearch.Margin = new Padding(0); pictureBoxSearch.Visible = false; panelLine.Visible = false; } diff --git a/Utilities/DataGridViewExtensions.cs b/Utilities/DataGridViewExtensions.cs index c8fc288..00715bd 100644 --- a/Utilities/DataGridViewExtensions.cs +++ b/Utilities/DataGridViewExtensions.cs @@ -4,6 +4,7 @@ namespace SystemTrayMenu.Utilities { + using System; using System.Data; using System.Drawing; using System.Windows.Forms; @@ -36,11 +37,7 @@ namespace SystemTrayMenu.Utilities int widthMaxInPixel = (int)(Scaling.Factor * Scaling.FactorByDpi * 400f * (Properties.Settings.Default.WidthMaxInPercent / 100f)); - if (widthMax > widthMaxInPixel) - { - widthMax = widthMaxInPixel; - } - + widthMax = Math.Min(widthMax, widthMaxInPixel); dgv.Columns[1].Width = (int)(widthMax + 0.5); double factorIconSizeInPercent = Properties.Settings.Default.IconSizeInPercent / 100f;