diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index df924a7..d0f4349 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.0.15.1")] -[assembly: AssemblyFileVersion("1.0.15.1")] +[assembly: AssemblyVersion("1.0.16.0")] +[assembly: AssemblyFileVersion("1.0.16.0")] diff --git a/UserInterface/AppContextMenu.cs b/UserInterface/AppContextMenu.cs index 4b9391a..001a04e 100644 --- a/UserInterface/AppContextMenu.cs +++ b/UserInterface/AppContextMenu.cs @@ -94,14 +94,14 @@ namespace SystemTrayMenu.Helper AppMoreInfo = versionInfo.LegalCopyright, }; ab.AppMoreInfo += Environment.NewLine; - ab.AppMoreInfo += "Markus Hofknecht (mailto:Markus@Hofknecht.eu)"; - ab.AppMoreInfo += Environment.NewLine; - ab.AppMoreInfo += "Tanja Kauth (mailto:Tanja@Hofknecht.eu)"; - ab.AppMoreInfo += Environment.NewLine; - ab.AppMoreInfo += "http://www.hofknecht.eu/systemtraymenu/"; - ab.AppMoreInfo += Environment.NewLine; - ab.AppMoreInfo += "https://github.com/Hofknecht/SystemTrayMenu"; - ab.AppMoreInfo += Environment.NewLine; + ab.AppMoreInfo += "Markus Hofknecht (mailto:Markus@Hofknecht.eu)" + Environment.NewLine; + ab.AppMoreInfo += "Tanja Kauth (mailto:Tanja@Hofknecht.eu)" + Environment.NewLine; + + // Thanks for letting me being part of this project and that I am allowed to be listed here :-) + ab.AppMoreInfo += "Peter Kirmeier (mai" + "lto:top" + "ete" + "rk@f" + "reen" + "et." + "de)" + Environment.NewLine; + + ab.AppMoreInfo += "http://www.hofknecht.eu/systemtraymenu/" + Environment.NewLine; + ab.AppMoreInfo += "https://github.com/Hofknecht/SystemTrayMenu" + Environment.NewLine; ab.AppMoreInfo += Environment.NewLine; ab.AppMoreInfo += "GNU GENERAL PUBLIC LICENSE" + Environment.NewLine; ab.AppMoreInfo += "(Version 3, 29 June 2007)" + Environment.NewLine; diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index 3c38062..405f534 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -287,6 +287,12 @@ namespace SystemTrayMenu.UserInterface } } + /// + /// Update the position and size of the menu. + /// + /// Screen coordinates where the menu is allowed to be drawn in. + /// Predecessor menu (when available). + /// Defines where the first menu is drawn (when no predecessor is set). internal void AdjustSizeAndLocation( Rectangle bounds, Menu menuPredecessor, @@ -298,57 +304,8 @@ namespace SystemTrayMenu.UserInterface startLocation = StartLocation.Predecessor; } - // Update the height to fit in all rows - CheckForAutoResizeRowDone(); - void CheckForAutoResizeRowDone() - { - double factor = 1; - if (NativeMethods.IsTouchEnabled()) - { - factor = 1.5; - } - - if (menuPredecessor == null) - { - if (dgv.Tag == null && dgv.Rows.Count > 0) - { - // Find row size based on content and apply factor - dgv.AutoResizeRows(); - dgv.RowTemplate.Height = (int)(dgv.Rows[0].Height * factor); - dgv.Tag = true; - } - } - else - { - // Take over the height from predecessor menu - dgv.RowTemplate.Height = menuPredecessor.GetDataGridView().RowTemplate.Height; - dgv.Tag = true; - } - - // Patch size of each row - foreach (DataGridViewRow row in dgv.Rows) - { - row.Height = dgv.RowTemplate.Height; - } - } - - int menuRestNeeded = Height - dgv.Height; // Height of menu except all the rows - int dgvHeightMax = bounds.Height - menuRestNeeded; - - DataTable data = (DataTable)dgv.DataSource; - if (string.IsNullOrEmpty(data.DefaultView.RowFilter)) - { - int dgvHeight = dgv.Rows.GetRowsHeight(DataGridViewElementStates.None); // Height of all rows - if (dgvHeight > dgvHeightMax) - { - // Make all rows fit into the screen - dgvHeight = dgvHeightMax; - } - - dgv.Height = dgvHeight; - } - - // Update the width to fit in all entries + // Update the height and width + AdjustDataGridViewHeight(menuPredecessor, bounds.Height); AdjustDataGridViewWidth(); // Calculate X position @@ -476,6 +433,52 @@ namespace SystemTrayMenu.UserInterface CultureInfo.InvariantCulture); } + private void AdjustDataGridViewHeight(Menu menuPredecessor, int screenHeightMax) + { + double factor = 1; + if (NativeMethods.IsTouchEnabled()) + { + factor = 1.5; + } + + if (menuPredecessor == null) + { + if (dgv.Tag == null && dgv.Rows.Count > 0) + { + // Find row size based on content and apply factor + dgv.AutoResizeRows(); + dgv.RowTemplate.Height = (int)(dgv.Rows[0].Height * factor); + dgv.Tag = true; + } + } + else + { + // Take over the height from predecessor menu + dgv.RowTemplate.Height = menuPredecessor.GetDataGridView().RowTemplate.Height; + dgv.Tag = true; + } + + // Patch size of each row + foreach (DataGridViewRow row in dgv.Rows) + { + row.Height = dgv.RowTemplate.Height; + } + + DataTable data = (DataTable)dgv.DataSource; + if (string.IsNullOrEmpty(data.DefaultView.RowFilter)) + { + int dgvHeight = dgv.Rows.GetRowsHeight(DataGridViewElementStates.None); // Height of all rows + int dgvHeightMax = screenHeightMax - (Height - dgv.Height); // except dgv + if (dgvHeight > dgvHeightMax) + { + // Make all rows fit into the screen + dgvHeight = dgvHeightMax; + } + + dgv.Height = dgvHeight; + } + } + private void AdjustDataGridViewWidth() { DataGridViewExtensions.FastAutoSizeColumns(dgv);