/// <summary> /// 鼠标定位事件; /// </summary> /// <param name="p2"></param> private static void DoMouseLocAction(string p2) { string[] pointStr = p2.Split('+'); Double X = Convert.ToDouble(pointStr[0]) * Screen.PrimaryScreen.Bounds.Width; Double Y = Convert.ToDouble(pointStr[1]) * Screen.PrimaryScreen.Bounds.Height; PCControl.DoMouseSet((int)X, (int)Y); }
/// <summary> /// 按键事件处理 /// </summary> /// <param name="p1"></param> /// <param name="p2"></param> private static void DoKeyAction(string p1, string p2) { switch (p2) { case "DOWN": PCControl.keybd_event((byte)Convert.ToInt32(p1), 0, 0, 0); break; case "UP": PCControl.keybd_event((byte)Convert.ToInt32(p1), 0, 2, 0); break; } }
/// <summary> /// 鼠标其他事件; /// </summary> /// <param name="p1"></param> /// <param name="p2"></param> private static void DoMouseAction(string p1, string p2) { switch (p1) { case "P": DoMouseLocAction(p2); break; case "M": DoMouseMoveAction(p2); break; case "R": if (p2 == "DOWN") { PCControl.DoMouseClick("RDOWN"); } else { PCControl.DoMouseClick("RUP"); } break; case "L": if (p2 == "DOWN") { PCControl.DoMouseClick("LDOWN"); } else { PCControl.DoMouseClick("LUP"); } break; case "W": PCControl.DoMouseWheel(Convert.ToInt32(p2)); break; } }
/// <summary> /// 鼠标移动事件; /// </summary> /// <param name="p2"></param> private static void DoMouseMoveAction(string p2) { string[] pointStr = p2.Split('+'); PCControl.DoMouseMove(Convert.ToInt32(pointStr[0]), Convert.ToInt32(pointStr[1])); }