You need to call the Windows API SendMessage() function.
//using System.Runtime.InteropServices;
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
private void treeView1_DragOver(object sender, DragEventArgs e)
{
// Set a constant to define the autoscroll region
const Single scrollRegion = 20;
// See where the cursor is
Point pt = treeView1.PointToClient(Cursor.Position);
// See if we need to scroll up or down
if ((pt.Y + scrollRegion) > treeView1.Height)
{
// Call the API to scroll down
SendMessage(treeView1.Handle, (int)277, (int)1, 0);
}
else if (pt.Y < (treeView1.Top + scrollRegion))
{
// Call thje API to scroll up
SendMessage(treeView1.Handle, (int)277, (int)0, 0);
}
}