0
Cursor cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X + x, Cursor.Position.Y + y);

In the code above everyting works but the problem is that it moves the cursor too fast and I cant give x and y values smaller that 1 or -1 (requires int).

What can I do?

Mihai Bratulescu
  • 1,915
  • 3
  • 27
  • 43
  • 3
    What are you trying to do? you are setting the position of the Cursor, there is no gradual movement to the location that you are setting so you will not get any intermediate points. – Mark Hall Dec 27 '13 at 18:12
  • Why are you creating `new Cursor` I don't see you're using it? – Sriram Sakthivel Dec 27 '13 at 18:13
  • The `Cursor` tag you added to que question refers to database cursors :-) – everton Dec 27 '13 at 18:13
  • You are moving the cursor to a specific position therefore the transition will not be present. – KSdev Dec 27 '13 at 18:16
  • how do I make a tranzition? – Mihai Bratulescu Dec 27 '13 at 18:17
  • Use timer to move it if that's what you're looking for – Sriram Sakthivel Dec 27 '13 at 18:17
  • 3
    Movement is a change of position over time. In your code/question, there is nothing related to time. Please add information about how you try to control the rate/speed of change. –  Dec 27 '13 at 18:17
  • I dont controll it, that is all the code I wrote to move the mouse. What must I use to control the speed? – Mihai Bratulescu Dec 27 '13 at 18:19
  • 1
    To animate a transition over `n` pixels of distance, you decide how long you want it to take, determine how many *steps* that is (e.g. 500ms, in 10 steps that are 50ms apart) and divide `n` by the number of steps, and move the cursor `n/#steps` pixels each step of the animation. – EricLaw Dec 27 '13 at 18:30
  • 1
    See this [SO Question/Answer](http://stackoverflow.com/questions/913646/c-sharp-moving-the-mouse-around-realistically) – Mark Hall Dec 27 '13 at 18:32

0 Answers0