/// <summary> /// This method performs a unrandomized nine point calibration. /// </summary> public void Calibrate() { if (!this.IsConnected) { this.Connect(); } // Get presentation size Size presentationSize = PresentationScreen.GetPresentationResolution(); // Set calibration area size this.SendString("ET_CSZ " + presentationSize.Width.ToString() + " " + presentationSize.Height.ToString()); // Set calibration points int fivePercentX = (int)(0.05f * presentationSize.Width); int fivePercentY = (int)(0.05f * presentationSize.Height); int xHalf = presentationSize.Width / 2; int yHalf = presentationSize.Height / 2;//was Width Point topLeft = new Point(fivePercentX, fivePercentY); Point topMiddle = new Point(xHalf, fivePercentY); Point topRight = new Point(presentationSize.Width - fivePercentX, fivePercentY); Point middleLeft = new Point(fivePercentX, yHalf); Point center = new Point(xHalf, yHalf); Point middleRight = new Point(presentationSize.Width - fivePercentX, yHalf); Point bottomLeft = new Point(fivePercentX, presentationSize.Height - fivePercentY); Point bottomMiddle = new Point(xHalf, presentationSize.Height - fivePercentY); Point bottomRight = new Point(presentationSize.Width - fivePercentX, presentationSize.Height - fivePercentY); List <Point> calibrationPoints = new List <Point>(); calibrationPoints.Add(center); calibrationPoints.Add(topLeft); calibrationPoints.Add(topRight); calibrationPoints.Add(bottomLeft); calibrationPoints.Add(bottomRight); calibrationPoints.Add(middleLeft); calibrationPoints.Add(topMiddle); calibrationPoints.Add(middleRight); calibrationPoints.Add(bottomMiddle); ////this.SendString("ET_PNT 1 " + center.X.ToString() + " " + center.Y.ToString()); ////this.SendString("ET_PNT 2 " + topLeft.X.ToString() + " " + topLeft.Y.ToString()); ////this.SendString("ET_PNT 3 " + topRight.X.ToString() + " " + topRight.Y.ToString()); ////this.SendString("ET_PNT 4 " + bottomLeft.X.ToString() + " " + bottomLeft.Y.ToString()); ////this.SendString("ET_PNT 5 " + bottomRight.X.ToString() + " " + bottomRight.Y.ToString()); this.newCalibrationForm = new SMIiViewXCalibrationForm(); this.newCalibrationForm.CalibPointColor = this.smiSettings.CalibPointColor; this.newCalibrationForm.CalibPointSize = this.smiSettings.CalibPointSize; this.newCalibrationForm.BackColor = this.smiSettings.CalibBackgroundColor; this.newCalibrationForm.Width = presentationSize.Width; this.newCalibrationForm.Height = presentationSize.Height; this.newCalibrationForm.CalibrationPoints = calibrationPoints; PresentationScreen.PutFormOnPresentationScreen(this.newCalibrationForm, true); this.newCalibrationForm.Show(); // Starts calibration. this.SendString("ET_CAL 9"); // Wait 2 seconds at the center point. int counter = 0; do { Application.DoEvents(); Thread.Sleep(100); counter++; }while (counter < 50); // Accepts calibration point. this.SendString("ET_ACC"); }
/// <summary> /// This method performs a unrandomized nine point calibration. /// </summary> public void Calibrate() { if (!this.IsConnected) { this.Connect(); } // Get presentation size Size presentationSize = PresentationScreen.GetPresentationResolution(); // Set calibration area size this.SendString("ET_CSZ " + presentationSize.Width.ToString() + " " + presentationSize.Height.ToString()); // Set calibration points int fivePercentX = (int)(0.05f * presentationSize.Width); int fivePercentY = (int)(0.05f * presentationSize.Height); int xHalf = presentationSize.Width / 2; int yHalf = presentationSize.Height / 2;//was Width Point topLeft = new Point(fivePercentX, fivePercentY); Point topMiddle = new Point(xHalf, fivePercentY); Point topRight = new Point(presentationSize.Width - fivePercentX, fivePercentY); Point middleLeft = new Point(fivePercentX, yHalf); Point center = new Point(xHalf, yHalf); Point middleRight = new Point(presentationSize.Width - fivePercentX, yHalf); Point bottomLeft = new Point(fivePercentX, presentationSize.Height - fivePercentY); Point bottomMiddle = new Point(xHalf, presentationSize.Height - fivePercentY); Point bottomRight = new Point(presentationSize.Width - fivePercentX, presentationSize.Height - fivePercentY); List<Point> calibrationPoints = new List<Point>(); calibrationPoints.Add(center); calibrationPoints.Add(topLeft); calibrationPoints.Add(topRight); calibrationPoints.Add(bottomLeft); calibrationPoints.Add(bottomRight); calibrationPoints.Add(middleLeft); calibrationPoints.Add(topMiddle); calibrationPoints.Add(middleRight); calibrationPoints.Add(bottomMiddle); ////this.SendString("ET_PNT 1 " + center.X.ToString() + " " + center.Y.ToString()); ////this.SendString("ET_PNT 2 " + topLeft.X.ToString() + " " + topLeft.Y.ToString()); ////this.SendString("ET_PNT 3 " + topRight.X.ToString() + " " + topRight.Y.ToString()); ////this.SendString("ET_PNT 4 " + bottomLeft.X.ToString() + " " + bottomLeft.Y.ToString()); ////this.SendString("ET_PNT 5 " + bottomRight.X.ToString() + " " + bottomRight.Y.ToString()); this.newCalibrationForm = new SMIiViewXCalibrationForm(); this.newCalibrationForm.CalibPointColor = this.smiSettings.CalibPointColor; this.newCalibrationForm.CalibPointSize = this.smiSettings.CalibPointSize; this.newCalibrationForm.BackColor = this.smiSettings.CalibBackgroundColor; this.newCalibrationForm.Width = presentationSize.Width; this.newCalibrationForm.Height = presentationSize.Height; this.newCalibrationForm.CalibrationPoints = calibrationPoints; PresentationScreen.PutFormOnPresentationScreen(this.newCalibrationForm, true); this.newCalibrationForm.Show(); // Starts calibration. this.SendString("ET_CAL 9"); // Wait 2 seconds at the center point. int counter = 0; do { Application.DoEvents(); Thread.Sleep(100); counter++; } while (counter < 50); // Accepts calibration point. this.SendString("ET_ACC"); }