Beispiel #1
0
 public AnalyzedLLRecordEntry(string path, string action,
                              System.Windows.Forms.MouseButtons button, Point relPoint, DateTime time, string type, string name)
 {
     controlPath         = path;
     this.name           = name;
     this.time           = time;
     this.button         = button;
     this.relativePoint1 = relPoint;
     this.action         = action;
     if (relPoint.X >= 0 && relPoint.Y >= 0)
     {
         actionParams = new string[2] {
             "MouseButtons." + button.ToString(), "new Point(" + relPoint.X + ", " + relPoint.Y + ")"
         }
     }
     ;
     else
     {
         actionParams = new string[1] {
             "MouseButtons." + button.ToString()
         }
     };
     this.type = type;
     index     = statIndex;
     statIndex++;
 }
        protected override void ButtonUp(System.Windows.Forms.MouseButtons button, int x, int y)
        {
            NativeEnums.MouseEventFlags flag;
            switch (button)
            {
            case System.Windows.Forms.MouseButtons.Left:
                flag = NativeEnums.MouseEventFlags.LeftUp;
                break;

            case System.Windows.Forms.MouseButtons.Right:
                flag = NativeEnums.MouseEventFlags.RightUp;
                break;

            case System.Windows.Forms.MouseButtons.Middle:
                flag = NativeEnums.MouseEventFlags.MiddleUp;
                break;

            default:
                throw new NotImplementedException(button.ToString());
            }
            NativeMethods.mouse_event((uint)(flag | NativeEnums.MouseEventFlags.Absolute), (uint)NativeUtilities.CalculateAbsoluteCoordinateX(x), (uint)NativeUtilities.CalculateAbsoluteCoordinateY(y), 0, IntPtr.Zero);
        }
        int GetButtonCode(MouseEventArgs pArg)
        {
            int intButtonCode = -1;

            System.Windows.Forms.MouseButtons pButton = pArg.Button;

            switch (pButton.ToString())
            {
            case "Left":
                intButtonCode = 1;
                break;

            case "Right":
                intButtonCode = 2;
                break;

            case "Middle":
                intButtonCode = 4;
                break;
            }

            return(intButtonCode);
        }
        protected override void ButtonUp(System.Windows.Forms.MouseButtons button, int x, int y)
        {
            InputMessage message;

            switch (button)
            {
            case System.Windows.Forms.MouseButtons.Left:
                message = InputMessage.WM_LBUTTONUP;
                break;

            case System.Windows.Forms.MouseButtons.Right:
                message = InputMessage.WM_RBUTTONUP;
                break;

            case System.Windows.Forms.MouseButtons.Middle:
                message = InputMessage.WM_MBUTTONUP;
                break;

            default:
                throw new NotImplementedException(button.ToString());
            }

            DispatchMessage(message, IntPtr.Zero, new IntPtr(StUtil.Native.Internal.NativeUtilities.MakeLParam(x, y)));
        }