Esempio n. 1
0
        //</Snippet9>

        //<Snippet10>
        protected override void OnStylusUp(RawStylusInput rawStylusInput)
        {
            // Run the base class before modifying the data
            base.OnStylusUp(rawStylusInput);

            // Get the StylusPoints that have come in
            StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints();

            // Modify the (X,Y) data to move the points
            // inside the acceptable input area, if necessary
            for (int i = 0; i < stylusPoints.Count; i++)
            {
                StylusPoint sp = stylusPoints[i];
                if (sp.X < 50)
                {
                    sp.X = 50;
                }
                if (sp.X > 250)
                {
                    sp.X = 250;
                }
                if (sp.Y < 50)
                {
                    sp.Y = 50;
                }
                if (sp.Y > 250)
                {
                    sp.Y = 250;
                }
                stylusPoints[i] = sp;
            }

            // Copy the modified StylusPoints back to the RawStylusInput
            rawStylusInput.SetStylusPoints(stylusPoints);
        }
Esempio n. 2
0
        private void Filter(RawStylusInput rawStylusInput)
        {
            // Get the StylusPoints that have come in.
            StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints();

            // Modify the (X,Y) data to move the points
            // inside the acceptable input area, if necessary.
            for (int i = 0; i < stylusPoints.Count; i++)
            {
                StylusPoint sp = stylusPoints[i];
                if (sp.X < 50)
                {
                    sp.X = 50;
                }
                if (sp.X > 250)
                {
                    sp.X = 250;
                }
                if (sp.Y < 50)
                {
                    sp.Y = 50;
                }
                if (sp.Y > 250)
                {
                    sp.Y = 250;
                }
                stylusPoints[i] = sp;
            }

            // Copy the modified StylusPoints back to the RawStylusInput.
            rawStylusInput.SetStylusPoints(stylusPoints);
        }
Esempio n. 3
0
        private void Filter(RawStylusInput rawStylusInput)
        {
            StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints();

            for (int i = 0; i < stylusPoints.Count; i++)
            {
                StylusPoint sp = stylusPoints[i];
                if (sp.X < 100)
                {
                    sp.X = 100;
                }
                if (sp.X > 400)
                {
                    sp.X = 400;
                }
                if (sp.Y < 100)
                {
                    sp.Y = 100;
                }
                if (sp.Y > 400)
                {
                    sp.Y = 400;
                }
                stylusPoints[i] = sp;
            }
            rawStylusInput.SetStylusPoints(stylusPoints);
        }
Esempio n. 4
0
        private void Transform(RawStylusInput rawStylusInput)
        {
            StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints();

            for (int i = 0; i < stylusPoints.Count; i++)
            {
                StylusPoint sp = stylusPoints[i];
                Point       pt = (Point)sp;
                pt             *= _matrix;
                sp.X            = pt.X;
                sp.Y            = pt.Y;
                stylusPoints[i] = sp;
            }
            rawStylusInput.SetStylusPoints(stylusPoints);
        }
Esempio n. 5
0
        protected override void OnStylusMove(RawStylusInput rawStylusInput)
        {
            // Run the base class before modifying the data
            base.OnStylusMove(rawStylusInput);

            if (currentStylus == rawStylusInput.StylusDeviceId)
            {
                StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints();

                // Restrict the stylus input and add the filtered
                // points to collectedPoints.
                StylusPointCollection points = FilterPackets(pointsFromEvent);
                rawStylusInput.SetStylusPoints(points);
                collectedPoints.Add(points);
            }
        }
Esempio n. 6
0
        public void Move(Point p)
        {
            if (rs == null)
            {
                return;
            }
            Point offset = this.Element.PointToScreen(new Point());

            p = new Point(p.X - offset.X, p.Y - offset.Y);
            if (ForcedMove != null)
            {
                ForcedMove(this, p);
            }
            rs.SetStylusPoints(new StylusPointCollection(new StylusPoint[] { new StylusPoint(p.X, p.Y, 0.5f, rs.GetStylusPoints().First().Description, new int[] { 0, 1, 0 }) }));
            OnStylusMove(rs);
        }
Esempio n. 7
0
        protected override void OnStylusUp(RawStylusInput rawStylusInput)
        {
            // Run the base class before modifying the data
            base.OnStylusUp(rawStylusInput);

            if (currentStylus == rawStylusInput.StylusDeviceId)
            {
                StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints();

                // Restrict the stylus input and add the filtered
                // points to collectedPoints.
                StylusPointCollection points = FilterPackets(pointsFromEvent);
                rawStylusInput.SetStylusPoints(points);
                collectedPoints.Add(points);

                // Subscribe to the OnStylusUpProcessed method.
                rawStylusInput.NotifyWhenProcessed(collectedPoints);

                currentStylus = -1;
            }
        }
Esempio n. 8
0
        protected override void OnStylusDown(RawStylusInput rawStylusInput)
        {
            // Run the base class before modifying the data
            base.OnStylusDown(rawStylusInput);

            if (currentStylus == -1)
            {
                StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints();

                // Create an emtpy StylusPointCollection to contain the filtered
                // points.
                collectedPoints = new StylusPointCollection(pointsFromEvent.Description);

                // Restrict the stylus input and add the filtered
                // points to collectedPoints.
                StylusPointCollection points = FilterPackets(pointsFromEvent);
                rawStylusInput.SetStylusPoints(points);
                collectedPoints.Add(points);

                currentStylus = rawStylusInput.StylusDeviceId;
            }
        }