views:

135

answers:

1

i have a treview control with drag&drop functionality that response to draw the node outside the visible limits scrolling in the apropiate direction. The problem is that it scroll at light speed. I need a way to modify this speed.

+1  A: 

You should use a Timer. Enable it when you detect the item getting dragged near the top or bottom of the client area. Simply avoiding scrolling when the timer is busy. The Interval property of the timer determines how fast the scrolling takes place. A bonus effect is that the user can speed up the scrolling by waving the dragged item up-and-down.

I wrote some sample VB.NET code that uses this approach, you'll find it in this thread.

Hans Passant
i dont understad well the vb code, the handler for the tick event only disable the timer. The dragOver method call the EnsureVisible in the node and enable the timer, so how that actually slow down the scroll speed?..
voodoomsr
The EnsureVisible call is the one that implements the scrolling. Note that it is *only* called when the timer is off. So no scrolling takes place for the 250 msec that the timer is active. Slowing it down.
Hans Passant
ou yea i getit!!! thanks!!!
voodoomsr