mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-05-19 11:53:02 +12:00
parent
45da1c222c
commit
f867894a1e
|
@ -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.
|
||||
|
|
18
NativeDllImport/IsTouchEnabled.cs
Normal file
18
NativeDllImport/IsTouchEnabled.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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")]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue