private void button1_Click(object sender, EventArgs e) { label6.Text = ""; HWMM.mouseSpeed = trackBar1.Value; //posições das imagens caso encontrar Point?destino1 = null; Point?destino2 = null; //inicio do cursor e fim Point inicio = Point.Empty; Point destino = Point.Empty; int x = 0, y = 0; int.TryParse(txtXgo.Text, out x); int.TryParse(txtXgo.Text, out y); Bitmap screenshot = captureScreen(); bool achou1 = cronometrar_e_procurar(ref destino1, screenshot, (Bitmap)pictureBox1.Image); bool achou2 = cronometrar_e_procurar(ref destino2, screenshot, (Bitmap)pictureBox2.Image); destino = (destino2 ?? destino1 ?? new Point(x, y)); inicio = (destino1 ?? new Point(x, y)); if (achou2) { HWMM.SetCursorPos(inicio.X, inicio.Y); } mover_e_clicar(destino); }
private void txtXgo_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter && txtXgo.Text != "") { int x = int.Parse(txtXgo.Text); HWMM.SetCursorPos(x, Cursor.Position.Y); } } catch (Exception) { /*throw;*/ } }
private void txtYgo_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { int y = int.Parse(txtYgo.Text); HWMM.SetCursorPos(Cursor.Position.X, y); } } catch (Exception) { /*throw;*/ } }
private void mover_e_clicar(Point destino) { if (chkArrastarClique.Checked) { MouseLeftDown(); HWMM.MoveMouse(destino); MouseLeftUp(); } else { HWMM.MoveMouse(destino); } if (chkClicarFimMovimento.Checked) { MouseClick(); MouseClick(); } }