c#获取光标在屏幕中位置

需要调用win32api,winform、wpf通用

[DllImport("user32.dll")]
public static extern bool GetCursorPos(out POINT lpPoint);

[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
    public int X;
    public int Y;
    public POINT(int x, int y)
    {
        this.X = x;
        this.Y = y;
    }
}

  

你可能感兴趣的:(c#获取光标在屏幕中位置)