internal MyTouchScreen(TouchScreen.ActiveRectangle[] ars, Bitmap bmp) : base(ars) { _systemBmp = bmp; // the layout is a screen with 4 squares at the corners in the form of four 50x50 bitmaps // we assume that the screen width and height can contain the four bitmaps plus a 5 pixels // border around them // only the bitmaps will be 'clickable' int centerX = bmp.Width / 2; int centerY = bmp.Height / 2; _ar = new TouchScreen.ActiveRectangle[4]; // north/east _ar[0] = new TouchScreen.ActiveRectangle(centerX - 55, centerY - 55, 50, 50, null); // north/west _ar[1] = new TouchScreen.ActiveRectangle(centerX + 5, centerY - 55, 50, 50, null); // south/west _ar[2] = new TouchScreen.ActiveRectangle(centerX + 5, centerY + 5, 50, 50, null); // south/east _ar[3] = new TouchScreen.ActiveRectangle(centerX - 55, centerY + 5, 50, 50, null); }
/// <summary> /// Execute the sample code. /// </summary> private void Run(TouchScreen touchScreen) { touchScreen.OnTouchUp += new TouchScreenEventHandler(TouchUpHandler); touchScreen.OnGestureChanged += new TouchGestureEventHandler(GestureChangedHandler); Show(ScreenId.NorthEast, false); Thread.Sleep(Timeout.Infinite); }