HotKey[] Key = new HotKey[4];
Key[1] = new HotKey();
Key[2] = new HotKey();
Key[3] = new HotKey();
Key[1].KeyModifier = HotKey.KeyModifiers.Shift;
Key[1].Key = Keys.Q;
Key[1].HotKeyPressed += new KeyEventHandler(position1);
Key[2].KeyModifier = HotKey.KeyModifiers.Shift;
Key[2].Key = Keys.W;
Key[2].HotKeyPressed += new KeyEventHandler(position2);
Key[3].KeyModifier = HotKey.KeyModifiers.Shift;
Key[3].Key = Keys.E;
Key[3].HotKeyPressed += new KeyEventHandler(position3);
private void button1_Click(object sender, EventArgs e)
{
int shirina = Convert.ToInt32(textBox4.Text);
int Vnax, Vnay, Vx, Vy, Nx, Ny;
Vx = Convert.ToInt32(textBox1.Text);
Vy = Convert.ToInt32(textBox2.Text);
Nx = Convert.ToInt32(textBox3.Text);
Ny = Convert.ToInt32(textBox6.Text);
Vnax = (Convert.ToInt32(textBox7.Text) - Convert.ToInt32(textBox1.Text)) / (shirina - 1);
Vnay = (Convert.ToInt32(textBox2.Text) - Convert.ToInt32(textBox8.Text)) / (shirina - 1);
for (int i = 1; i <= shirina; i++)
{
Shag(Vx, Vy, Nx, Ny);
Vx += Vnax;
Vy -= Vnay;
Nx += Vnax;
Ny -= Vnay;
}
}
private void Shag(int Vx, int Vy, int Nx, int Ny)
{
int vysota = Convert.ToInt32(textBox5.Text);
int nax, nay, x, y;
int nS = 4;
int nCout = 1;
String Str = "left";
nax = (Nx - Vx) / (vysota - 1);
nay = (Ny - Vy) / (vysota - 1);
x = Vx;
y = Vy;
for (int i = 1; i <= vysota; i++)
{
autoIt.MouseClick(Str, x, y, nCout, nS);
x += nax;
y += nay;
}
Source: https://habr.com/ru/post/126964/