#113, version 0.11.1.10

[Feature] Bigger buttons for Touch #113
This commit is contained in:
Markus Hofknecht 2020-06-27 12:37:52 +02:00
parent 45da1c222c
commit f867894a1e
4 changed files with 39 additions and 14 deletions

View file

@ -84,8 +84,8 @@ namespace SystemTrayMenu.Business
void StartLoadMenu(RowData rowData)
{
if (menus[0].IsUsable &&
menus[rowData.MenuLevel + 1] == null ||
menus[rowData.MenuLevel + 1].Tag as RowData != rowData)
(menus[rowData.MenuLevel + 1] == null ||
menus[rowData.MenuLevel + 1].Tag as RowData != rowData))
{
LoadStarted();
BackgroundWorker workerSubMenu = workersSubMenu.

View file

@ -0,0 +1,18 @@
using System.Runtime.InteropServices;
namespace SystemTrayMenu.DllImports
{
public static partial class NativeMethods
{
[DllImport("user32.dll")]
private static extern int GetSystemMetrics(int nIndex);
public static bool IsTouchEnabled()
{
const int MAXTOUCHES_INDEX = 95;
int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX);
return maxTouches > 0;
}
}
}

View file

@ -35,5 +35,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("0.11.1.9")]
[assembly: AssemblyFileVersion("0.11.1.9")]
[assembly: AssemblyVersion("0.11.1.10")]
[assembly: AssemblyFileVersion("0.11.1.10")]

View file

@ -244,25 +244,32 @@ namespace SystemTrayMenu.UserInterface
CheckForAutoResizeRowDone();
void CheckForAutoResizeRowDone()
{
double factor = 1;
if (NativeMethods.IsTouchEnabled())
{
factor = 1.5;
}
if (dgv.Tag == null)
{
if (menuPredecessor == null)
{
dgv.AutoResizeRows();
if (factor > 1)
{
dgv.RowTemplate.Height = (int)(dgv.RowTemplate.Height * factor);
foreach (DataGridViewRow row in dgv.Rows)
{
row.Height = dgv.RowTemplate.Height;
}
}
dgv.Tag = true;
}
else
{
DataGridView dgvPredecessor = menuPredecessor.GetDataGridView();
if (dgvPredecessor.Rows.Count > 0)
{
int rowHeight = dgvPredecessor.Rows[0].Height;
foreach (DataGridViewRow row in dgv.Rows)
{
row.Height = rowHeight;
}
dgv.Tag = true;
}
dgv.RowTemplate.Height = menuPredecessor.GetDataGridView().
RowTemplate.Height;
dgv.Tag = true;
}
}
}