[Feature] DragDrop a file into a application (#34), version 1.1.0.6

This commit is contained in:
Markus Hofknecht 2021-11-24 00:22:38 +01:00
parent 92d7e058a9
commit 79f0bbe740
4 changed files with 18 additions and 13 deletions

View file

@ -153,10 +153,10 @@ namespace SystemTrayMenu.Handler
if (iRowKey > -1 &&
dgv.Rows.Count > iRowKey)
{
Point pt = dgv.GetCellDisplayRectangle(2, iRowKey, false).Location;
Point point = dgv.GetCellDisplayRectangle(2, iRowKey, false).Location;
RowData trigger = (RowData)dgv.Rows[iRowKey].Cells[2].Value;
MouseEventArgs mea = new(MouseButtons.Right, 1, pt.X, pt.Y, 0);
trigger.MouseClick(dgv, mea, out bool toCloseByDoubleClick);
MouseEventArgs mouseEventArgs = new(MouseButtons.Right, 1, point.X, point.Y, 0);
trigger.MouseDown(dgv, mouseEventArgs);
}
}
@ -319,10 +319,7 @@ namespace SystemTrayMenu.Handler
RowData trigger = (RowData)dgv.Rows[iRowKey].Cells[2].Value;
if (trigger.IsMenuOpen || !trigger.ContainsMenu)
{
trigger.MouseClick(
dgv,
null,
out bool toCloseByMouseClick);
trigger.MouseClick(null, out bool toCloseByMouseClick);
trigger.DoubleClick(
new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0),
out bool toCloseByDoubleClick);

View file

@ -953,6 +953,12 @@ namespace SystemTrayMenu.Business
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hitTestInfo;
hitTestInfo = dgv.HitTest(e.X, e.Y);
if (hitTestInfo.RowIndex > -1 &&
hitTestInfo.RowIndex < dgv.Rows.Count)
{
RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
rowData.MouseDown(dgv, e);
}
if (e.Button == MouseButtons.Left)
{
@ -994,7 +1000,7 @@ namespace SystemTrayMenu.Business
hitTestInfo.RowIndex < dgv.Rows.Count)
{
RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
rowData.MouseClick(dgv, e, out bool toCloseByClick);
rowData.MouseClick(e, out bool toCloseByClick);
waitToOpenMenu.ClickOpensInstantly(dgv, hitTestInfo.RowIndex);
if (toCloseByClick)
{

View file

@ -147,10 +147,8 @@ namespace SystemTrayMenu.DataClasses
return isLnkDirectory;
}
internal void MouseClick(DataGridView dgv, MouseEventArgs e, out bool toCloseByDoubleClick)
internal void MouseDown(DataGridView dgv, MouseEventArgs e)
{
toCloseByDoubleClick = false;
if (e != null &&
e.Button == MouseButtons.Right &&
FileInfo != null &&
@ -181,7 +179,11 @@ namespace SystemTrayMenu.DataClasses
IsContextMenuOpen = false;
contextMenuClosed = DateTime.Now;
}
}
internal void MouseClick(MouseEventArgs e, out bool toCloseByDoubleClick)
{
toCloseByDoubleClick = false;
if (Properties.Settings.Default.OpenItemWithOneClick)
{
OpenItem(e, ref toCloseByDoubleClick);

View file

@ -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.1.0.5")]
[assembly: AssemblyFileVersion("1.1.0.5")]
[assembly: AssemblyVersion("1.1.0.6")]
[assembly: AssemblyFileVersion("1.1.0.6")]