Пример #1
0
        private void DecodePanGesture(ref Win32.GESTUREINFO gestureInfo)
        {
            PanGestureEventArgs args = new PanGestureEventArgs();

            switch (gestureInfo.dwFlags)
            {
            case Win32.GF_BEGIN:
            {
                args.state          = GestureState.Begin;
                mPanInfo.ptFirst.X  = gestureInfo.ptsLocation.X;
                mPanInfo.ptFirst.Y  = gestureInfo.ptsLocation.Y;
                mPanInfo.ptSecond.X = 0;
                mPanInfo.ptSecond.Y = 0;
            }
            break;

            case Win32.GF_END:
            {
                args.state          = GestureState.End;
                mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
            }
            break;

            case Win32.GF_INERTIA:
            {
                args.state          = GestureState.Inertia;
                mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
            }
            break;

            default:     // Pan Move
            {
                args.state          = GestureState.Move;
                mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
            }
            break;
            }

            // Copy the pan coordinates into the event args and fire the event
            args.distance   = (int)(gestureInfo.ullArguments & Win32.ULL_ARGUMENTS_BIT_MASK);
            args.ptFirst.X  = mPanInfo.ptFirst.X;
            args.ptFirst.Y  = mPanInfo.ptFirst.Y;
            args.ptSecond.X = mPanInfo.ptSecond.X;
            args.ptSecond.Y = mPanInfo.ptSecond.Y;
            if (PanEventHandler != null)
            {
                PanEventHandler(this, args);
            }

            mPanInfo.argument = (int)(gestureInfo.ullArguments & Win32.ULL_ARGUMENTS_BIT_MASK);
            if (gestureInfo.dwFlags != Win32.GF_BEGIN)
            {
                // Set the first point to the second point, so we can have it as first next time
                mPanInfo.ptFirst.X = mPanInfo.ptSecond.X;
                mPanInfo.ptFirst.Y = mPanInfo.ptSecond.Y;
            }
        }
Пример #2
0
        private void DecodePanGesture(ref Win32.GESTUREINFO gestureInfo)
        {
            PanGestureEventArgs e = new PanGestureEventArgs();

            switch (gestureInfo.dwFlags)
            {
            case 1:
                e.state = GestureState.Begin;
                this.mPanInfo.ptFirst.X  = gestureInfo.ptsLocation.X;
                this.mPanInfo.ptFirst.Y  = gestureInfo.ptsLocation.Y;
                this.mPanInfo.ptSecond.X = 0;
                this.mPanInfo.ptSecond.Y = 0;
                break;

            case 2:
                e.state = GestureState.Inertia;
                this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                break;

            case 4:
                e.state = GestureState.End;
                this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                break;

            default:
                e.state = GestureState.Move;
                this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                break;
            }
            e.distance   = (int)(((ulong)gestureInfo.ullArguments) & 0xffffffffL);
            e.ptFirst.X  = this.mPanInfo.ptFirst.X;
            e.ptFirst.Y  = this.mPanInfo.ptFirst.Y;
            e.ptSecond.X = this.mPanInfo.ptSecond.X;
            e.ptSecond.Y = this.mPanInfo.ptSecond.Y;
            if (this.PanEventHandler != null)
            {
                this.PanEventHandler(this, e);
            }
            this.mPanInfo.argument = (int)(((ulong)gestureInfo.ullArguments) & 0xffffffffL);
            if (gestureInfo.dwFlags != 1)
            {
                this.mPanInfo.ptFirst.X = this.mPanInfo.ptSecond.X;
                this.mPanInfo.ptFirst.Y = this.mPanInfo.ptSecond.Y;
            }
        }
Пример #3
0
        private void DecodePanGesture(ref Win32.GESTUREINFO gestureInfo)
        {
            PanGestureEventArgs e = new PanGestureEventArgs();
            switch (gestureInfo.dwFlags)
            {
                case 1:
                    e.state = GestureState.Begin;
                    this.mPanInfo.ptFirst.X = gestureInfo.ptsLocation.X;
                    this.mPanInfo.ptFirst.Y = gestureInfo.ptsLocation.Y;
                    this.mPanInfo.ptSecond.X = 0;
                    this.mPanInfo.ptSecond.Y = 0;
                    break;

                case 2:
                    e.state = GestureState.Inertia;
                    this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                    this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                    break;

                case 4:
                    e.state = GestureState.End;
                    this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                    this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                    break;

                default:
                    e.state = GestureState.Move;
                    this.mPanInfo.ptSecond.X = gestureInfo.ptsLocation.X;
                    this.mPanInfo.ptSecond.Y = gestureInfo.ptsLocation.Y;
                    break;
            }
            e.distance = (int) (((ulong) gestureInfo.ullArguments) & 0xffffffffL);
            e.ptFirst.X = this.mPanInfo.ptFirst.X;
            e.ptFirst.Y = this.mPanInfo.ptFirst.Y;
            e.ptSecond.X = this.mPanInfo.ptSecond.X;
            e.ptSecond.Y = this.mPanInfo.ptSecond.Y;
            if (this.PanEventHandler != null)
            {
                this.PanEventHandler(this, e);
            }
            this.mPanInfo.argument = (int) (((ulong) gestureInfo.ullArguments) & 0xffffffffL);
            if (gestureInfo.dwFlags != 1)
            {
                this.mPanInfo.ptFirst.X = this.mPanInfo.ptSecond.X;
                this.mPanInfo.ptFirst.Y = this.mPanInfo.ptSecond.Y;
            }
        }