首页 > 代码库 > C#控制鼠标位置

C#控制鼠标位置

It is not possible using the .NET BCL. However if you really want it you can use native SetCursorPos inUser32.dll.

[DllImport("User32.dll")]
private static extern bool SetCursorPos(int x, int y);

As others will most likely point out, you can achieve the same using System.Windows.Forms, however when developing a WPF application prefer use DllImport.