Good afternoon, how to move the mouse cursor, for example, X = 400. Y = 700, here in such coordinates.

Please help me.

private void start_game () { Cursor.Position = new Point(400, 700); } private void FormLevel1_Shown(object sender, EventArgs e) { start_game(); } 
  • one
    tried to look in msdn ? - KoVadim
  • Yes, but I didn’t understand well - Ilya Vityuk
  • @ Ilyavityuk, you just need to assign the necessary coordinates to the property Position - Grundy
  • Can I use an example? Of course, I'll try it myself now but can you give me an example too? - Ilya Vityuk
  • one
    from msd: Cursor.Position = new Point(400, 700); - Grundy

1 answer 1

Since no one wants to post a response, I will have to.

The Cursor.Position property returns and sets the position of the cursor. Specifically, in your case you need:

 Cursor.Position = new Point(400, 700); 
  • @Grundy something I can not do what? Although no error gives - Ilya Vityuk
  • This is what he himself wrote `private void start_game () {Cursor.Position = new Point (400, 700); } private void FormLevel1_Shown (object sender, EventArgs e) {start_game (); } ` - Ilya Vityuk
  • @ Ilyavityuk First - add this to the question. Secondly, check with the debugger to see if implementation comes into this method - Kromster
  • @Grundy checked the debugger, he goes there but does not change anything - Ilya Vityuk
  • checked the debugger, he goes there but does not change anything - Ilya Vityuk