Exemplo n.º 1
0
 private void AutoMouseClickSetting_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Alt && (e.KeyCode == Keys.L || e.KeyCode == Keys.D || e.KeyCode == Keys.R))
         {
             clickType = MouseActionEntity.GetClickType(e.KeyCode);
             int x = Cursor.Position.X;
             int y = Cursor.Position.Y;
             MouseActionEntity mouseInfo = new MouseActionEntity(
                 x, y, string.Empty, 0, clickType);
             InputForm form = new InputForm(mouseInfo);
             if (form.ShowDialog() == DialogResult.OK)
             {
                 //Add one list
                 form.MouseResult.ActionNo = mouseInfoList.Count + 1;
                 mouseInfoList.Add(form.MouseResult);
                 this.dgvClickInfo.Refresh();
                 this.dgvClickInfo.Rows[mouseInfoList.Count - 1].Selected = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private void WorkClick(object state)
 {
     this.context.Send(new SendOrPostCallback(delegate(object _state)
     {
         MouseActionEntity action = state as MouseActionEntity;
         Win32.SetCursorPos(action.X, action.Y);
         Thread.Sleep(100);
         if (action.Type.Equals(ClickType.click))
         {
             Logger.WriteLog(action.ActionNo + " " + action.X.ToString() + " " + action.Y.ToString() + " " + action.Interval.ToString());
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
         }
         else if (action.Type.Equals(ClickType.doubleClick))
         {
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
             Thread.Sleep(100);
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
             Win32.mouse_event(Win32.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
         }
         else //if (action.Type.Equals(ClickType.rightClick))
         {
             Win32.mouse_event(Win32.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
             Win32.mouse_event(Win32.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
         }
     }), state);
 }
Exemplo n.º 3
0
 public InputForm(MouseActionEntity mouseInfo) : this()
 {
     MouseResult        = mouseInfo;
     txtX.Text          = mouseInfo.X.ToString();
     txtY.Text          = mouseInfo.Y.ToString();
     txtClickEvent.Text = MouseActionEntity.GetDisplayType(mouseInfo.Type);
     txtComment.Text    = mouseInfo.Comment;
     numWaiting.Value   = mouseInfo.Interval;
 }
Exemplo n.º 4
0
 private void dgvClickInfo_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvClickInfo.SelectedRows.Count > 0)
         {
             MouseActionEntity mouseInfo = mouseInfoList[this.dgvClickInfo.SelectedRows[0].Index];
             InputForm         form      = new InputForm(mouseInfo);
             if (form.ShowDialog() == DialogResult.OK)
             {
                 mouseInfoList[this.dgvClickInfo.SelectedRows[0].Index] = form.MouseResult;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }