[英]C# How to move mouse(cursor) position while its hidden…?
My cursor.position function works, but when the cursor is focused in a window and hidden ( for example in a game when the cursor hides itself ) it doesn't move... Any solution? 我的cursor.position函数可以工作,但是当光标聚焦在窗口中并隐藏时(例如,在游戏中光标隐藏自身时),它不会移动...有解决方案吗? My code:
我的代码:
Cursor.Position = new Point(Cursor.Position.X + Xvariable, Cursor.Position.Y + Yvariable);
You can test this one 你可以测试一下
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
private const int MOUSEEVENTF_MOVE = 0x0001;
public static void Move(int xDelta, int yDelta)
{
mouse_event(MOUSEEVENTF_MOVE, xDelta, yDelta, 0, 0);
}
Usage Move(830, 160);
用法
Move(830, 160);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.