当前位置:主页 > 软件编程 > .NET代码 >

c#获取光标在屏幕中位置的简单实例

时间:2021-07-31 08:03:06 | 栏目:.NET代码 | 点击:

需要调用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;
    }
}

您可能感兴趣的文章:

相关文章