C#程序如何控制鼠标移动到某个位置
展开全部
请参照一下代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
SetPos();
}
[DllImport("User32.dll")]
private static extern bool SetCursorPos(int x, int y);
private static void SetPos()
{
int dx = 1000;
int dy = 100;
SetCursorPos(dx, dy);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
SetPos();
}
[DllImport("User32.dll")]
private static extern bool SetCursorPos(int x, int y);
private static void SetPos()
{
int dx = 1000;
int dy = 100;
SetCursorPos(dx, dy);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询