Exemplo n.º 1
0
        ///<summary>
        ///MouseHookedイベントを発生させる。
        ///</summary>
        ///<param name="e">イベントのデータ。</param>
        protected virtual void OnMouseHooked(MouseHookedEventArgs e)
        {
            MouseHookedEventHandler handler = base.Events[EventMouseHooked] as MouseHookedEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
 private int CallNextHook(int code, MouseMessage message, ref MouseState state)
 {
     if (code >= 0)
     {
         MouseHookedEventArgs e = new MouseHookedEventArgs(message, ref state);
         this.OnMouseHooked(e);
         if (e.Cancel)
         {
             return(-1);
         }
     }
     return(CallNextHookEx(hook, code, message, ref state));
 }
Exemplo n.º 3
0
        private void AutoInput(object sender, MouseHookedEventArgs e)
        {
            if (!this._autoInputFlag)
            {
                return;
            }
            switch (e.Message)
            {
            case MouseMessage.LUp:
            case MouseMessage.RUp:
                if (!Client.IsAlive || !Client.IsActiveWindow)
                {
                    return;
                }
                this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.X].Value         = Math.Round(e.Point.X / Client.ratioW) - Client.x;
                this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.Y].Value         = Math.Round(e.Point.Y / Client.ratioH) - Client.y;
                this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.OPERATION].Value = e.Message == MouseMessage.LUp ? MouseOperationText.LEFT : MouseOperationText.RIGHT;
                break;

            case MouseMessage.Move:
            case MouseMessage.LDown:
            case MouseMessage.RDown:
            case MouseMessage.MDown:
            case MouseMessage.MUp:
            case MouseMessage.Wheel:
            case MouseMessage.XDown:
            case MouseMessage.XUp:
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
            this._autoInputFlag = false;
            this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.X].Style.BackColor         = Color.White;
            this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.Y].Style.BackColor         = Color.White;
            this.dgv.Rows[this._autoInputRowIndex].Cells[DgvCol.OPERATION].Style.BackColor = Color.White;
        }