Friday, April 8, 2011

How to Make a Mouse Scroll Programmatically?

Related question: mouse drag & drop (identical code snippet)


how do I a make mouse scroll programmatically? I've tried:

SetCursorPos(32, 32);
 mouse_event((uint)MouseEventFlags.RIGHTDOWN,0,0,0,0);
 mouse_event((uint)MouseEventFlags.RIGHTUP,0,0 ,0,0); 
 SetCursorPos(38, 38);
 mouse_event((uint)MouseEventFlags.LEFTDOWN,0,0 ,0,0);    
 mouse_event((uint)MouseEventFlags.LEFTUP,0,0 ,0,0);

The above code-snippet opens the top-left most item in a screen.

Does anyone have a code-snippet that will made the mouse scroll?

From stackoverflow
  • Are you trying to scroll to a specific place or just scroll in general? If you are trying to scroll to a specific place, like the end of a text box you could do something like:

    myTxtBox.SelectionStart = myTxtBox.TextLength; myTxtBox.ScrollToCaret();

0 comments:

Post a Comment