コード例 #1
0
        /// <summary>
        /// Starts the touch calibration
        /// </summary>
        /// <param name="cc">Configuration to use when calibrating the screen</param>
        /// <remarks>
        /// This will show the touch calibration window.
        /// </remarks>
        public static void CalibrateTouch(CalibrationConfiguration cc)
        {
            IContainer prv = Core.ActiveContainer;
            var        cw  = new CalibrationWindow(cc);

            Core.ActiveContainer = cw;

            _activeBlock = new ManualResetEvent(false);
            _activeBlock.Reset();

            while (!_activeBlock.WaitOne(1000, false))
            {
            }

            _activeBlock = null;

            Core.ActiveContainer = prv;
        }
コード例 #2
0
            public CalibrationWindow(CalibrationConfiguration cc)
            {
                int i;

                _sy    = null;
                _cc    = cc;
                _step1 = true;

                X      = 0;
                Y      = 0;
                Width  = Core.Screen.Width;
                Height = Core.Screen.Height;


                // Ask the touch system how many points are needed to
                // calibrate.
                Touch.ActiveTouchPanel.GetCalibrationPointCount(ref _calibrationpointCount);

                // Create the calibration point array.
                _calpoints = new point[_calibrationpointCount];
                _sx        = new short[_calibrationpointCount];
                _sy        = new short[_calibrationpointCount];
                _cx        = new short[_calibrationpointCount];
                _cy        = new short[_calibrationpointCount];

                // Get the points for calibration.
                for (i = 0; i < _calibrationpointCount; i++)
                {
                    Touch.ActiveTouchPanel.GetCalibrationPoint(i, ref _x, ref _y);
                    _calpoints[i].X = _x;
                    _calpoints[i].Y = _y;

                    _sx[i] = (short)_x;
                    _sy[i] = (short)_y;
                }

                // Start the calibration process.
                _currentCalpoint = 0;
                Touch.ActiveTouchPanel.StartCalibration();
            }