mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-05-15 18:03:01 +12:00
[Feature] Swipe scrolling on touchscreen (#275), version 1.2.1.4
This commit is contained in:
parent
8354e9fece
commit
72b9f56e74
|
@ -1038,14 +1038,17 @@ namespace SystemTrayMenu.Business
|
|||
if (newRow > -1)
|
||||
{
|
||||
int delta = dragSwipeScrollingStartRowIndex - newRow;
|
||||
DoScroll(dgv, delta * 2);
|
||||
dragSwipeScrollingStartRowIndex += delta;
|
||||
if (DoScroll(dgv, ref delta))
|
||||
{
|
||||
dragSwipeScrollingStartRowIndex += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DoScroll(DataGridView dgv, int delta)
|
||||
private bool DoScroll(DataGridView dgv, ref int delta)
|
||||
{
|
||||
bool scrolled = false;
|
||||
if (delta != 0)
|
||||
{
|
||||
if (delta < 0 && dgv.FirstDisplayedScrollingRowIndex == 0)
|
||||
|
@ -1053,15 +1056,24 @@ namespace SystemTrayMenu.Business
|
|||
delta = 0;
|
||||
}
|
||||
|
||||
int newFirstDisplayedScrollingRowIndex = dgv.FirstDisplayedScrollingRowIndex + delta;
|
||||
int newFirstDisplayedScrollingRowIndex = dgv.FirstDisplayedScrollingRowIndex + (delta * 2);
|
||||
|
||||
if (newFirstDisplayedScrollingRowIndex < 0 || newFirstDisplayedScrollingRowIndex >= dgv.RowCount)
|
||||
{
|
||||
newFirstDisplayedScrollingRowIndex = dgv.FirstDisplayedScrollingRowIndex + delta;
|
||||
}
|
||||
|
||||
if (newFirstDisplayedScrollingRowIndex > -1 && newFirstDisplayedScrollingRowIndex < dgv.RowCount)
|
||||
{
|
||||
isDragSwipeScrolled = true;
|
||||
dgv.FirstDisplayedScrollingRowIndex = newFirstDisplayedScrollingRowIndex;
|
||||
Menu menu = (Menu)dgv.FindForm();
|
||||
menu.AdjustScrollbar();
|
||||
scrolled = dgv.FirstDisplayedScrollingRowIndex == newFirstDisplayedScrollingRowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return scrolled;
|
||||
}
|
||||
|
||||
private void Dgv_MouseDown(object sender, MouseEventArgs e)
|
||||
|
|
|
@ -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.2.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.2.1.3")]
|
||||
[assembly: AssemblyVersion("1.2.1.4")]
|
||||
[assembly: AssemblyFileVersion("1.2.1.4")]
|
||||
|
|
Loading…
Reference in a new issue