Example #1
0
        public DrawPicture(TouchlessMgr tlmgr, Rectangle displayBounds, string fileName)
        {
            this.tlmgr = tlmgr;

            // Initialize the display bounds
            displayWidth = displayBounds.Width;
            displayHeight = displayBounds.Height;

            cameraWidth = tlmgr.Cameras[0].CaptureWidth;
            cameraHeight = tlmgr.Cameras[0].CaptureHeight;

            pics = new Pictures(@fileName);
            pic = pics.getPicAutoPlus();

            // Initialize the canvas for drawing and its graphics object
            canvas = new Bitmap(tlmgr.CurrentCamera.CaptureWidth, tlmgr.CurrentCamera.CaptureHeight);
            canvasGFX = Graphics.FromImage(canvas);
            canvasGFX.FillRectangle(new SolidBrush(Color.FromArgb(64, 255, 255, 255)), 0, 0, canvas.Width, canvas.Height);

            // Initialize the points and pen used for drawing segments
            pen = new Pen(Color.Black);
            //p1 = new Point();
            p2 = new Point();

            // Add marker update handling
            foreach (Marker marker in tlmgr.Markers)
            {
                marker.OnChange += new EventHandler<MarkerEventArgs>(updateMarker);
            }

            //开始时间
            pics.setStartTime();
        }