mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-28 15:21:37 +12:00
[Feature] Support other taskbar orientations (#13), version 1.0.16.0
Add me (topeterk) to About box Little bit of housekeeping
This commit is contained in:
parent
7426a44409
commit
684babe9db
3 changed files with 64 additions and 61 deletions
|
@ -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")]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -287,6 +287,12 @@ namespace SystemTrayMenu.UserInterface
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the position and size of the menu.
|
||||
/// </summary>
|
||||
/// <param name="bounds">Screen coordinates where the menu is allowed to be drawn in.</param>
|
||||
/// <param name="menuPredecessor">Predecessor menu (when available).</param>
|
||||
/// <param name="startLocation">Defines where the first menu is drawn (when no predecessor is set).</param>
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue