c# 通过坐标来确定点击位置,点击具体的内容

202 阅读1分钟

public static int left_screen = Screen.PrimaryScreen.Bounds.Width; //获取桌面的分辨率 public static int top_screen = Screen.PrimaryScreen.Bounds.Height;//获取桌面分辨率 通过FindWindow查找到句柄 通过GetWindowRect 获取到具体坐标 int Topclick = (rect.Top + 6) * 65535 / top_screen;//通过分辨率来获取桌面的具体位置 int Leftclick = (rect.Left + 41) * 65535 / left_screen;//通过分辨率来获取桌面的具体位置

通过 SetCursorPos()来定位到某个地方 然后执行mouse_event事件