C#控制鼠标移动
1。找到元素坐标;
HtmlElement OffsetRectangle.X,Y属性可以知道坐标
2。C#控制鼠标移动
通过SetCursorPos(x,y)可以控制鼠标坐标
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;namespace WindowsApplication10
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern int SetCursorPos(int x, int y);
public Form1()
{
InitializeComponent();
}
int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 10000;
}
private void timer1_Tick(object sender, EventArgs e)
{
i = i + 3;
SetCursorPos(i, i);
}
}
}