How can you implement a smooth movement of the mouse cursor to a point on the C # screen in Microsoft Visual Studio?
1 answer
Smooth movement can be implemented on a timer.
For example, in a Windows Forms application. Or in an application of any other type, but you also need to add a link to the System.Windows.Forms.dll
library in the References
project. This is needed so that you can access the Position
property of the Cursor
class.
In the code we write:
using System.Windows.Forms; // Поле класса System.Threading.Timer timer; // Создаём и запускаем таймер с интервалом 10 миллисекунд timer = new System.Threading.Timer(CursorMove, null, 0, 10); // Метод, вызываемый таймером. Перемещает курсор private void CursorMove(object state) { var point = Cursor.Position; point.X++; Cursor.Position = point; }
When the timer needs to be stopped, we call
timer.Dispose();
|
ctrl и +
andctrl и -
keys (or the back and forth mouse buttons). Between breakpoints, as far as I know, it’s impossible to cross over with shokatas (except F10, F11, SHift + F11) - GRUNGER