I am creating an application using UltraWinGrid for a WinXP touchpad. I would like to get the scrolling capability in the grid like on an iPad - swipe up to scroll down, swipe down to scroll up. Can I get this capability?
If it's not possible in WinXP, is it possible in WIn7?
Hello,
Currently UltraGrid doesn’t support such functionality, but you could achieve this, if you are handling mouse move event of the UltraGrid and use code like:
if (ultraGrid1.Capture)
{
int abs = Math.Abs(e.Y - oldPosition.Y);
if ( abs> 10)// determine if user hit to scroll
int adjust = (e.Y - oldPosition.Y);
int sign = adjust > -1 ? -1 : 1;//direction of scrolling - up or down
//cause scrolling to be fast at the beginning and to slow down at the end
for (int i = 0; i < abs; i +=1)
ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition += (int)(((e.Y - oldPosition.Y) + sign*i)*0.02);
ultraGrid1.Refresh();
}
else
ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition += e.Y - oldPosition.Y;
oldPosition = e.Location;
I am attaching the sample which I have created.
Please let me know if you have any further questions.
Thanks for your insight. I see what you are getting at.
There are, however, 2 issues:
1) The scroll is in the wrong direction than I wanted. But that is easily solved by changing the += to -=. So that's OK.
2) The more difficult problem is that the scroll is not in sync with the mouse movement. If you MouseDown on a row, and move the mouse just a drop, the data row moves alot. In other words, the row you have the MouseDown on doesn't graphically sync with the mouse movement. Is there a way to keep the two in sync, so that the row you've MouseDowned on stays under the mouse as you move it? That's the way it works on an iPad, and that's the way a user would intuitively expect it to work.
Thanks for any assistance.