C#程序如何控制鼠标移动到某个位置

就是用C#程序控制鼠标移动到某个位置,比如移动到开始菜单里的log off位置

请参照一下代码:
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);
}
}
}
温馨提示:答案为网友推荐,仅供参考
相似回答