Ejemplo n.º 1
0
        public Image MakeScreenshot()
        {
            Bitmap img = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                                    Screen.PrimaryScreen.Bounds.Height);

            using (Graphics g = Graphics.FromImage(img))
            {
                g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
                                 Screen.PrimaryScreen.Bounds.Y,
                                 0, 0,
                                 img.Size,
                                 CopyPixelOperation.SourceCopy);
            }
            Size imgSize = Utils.CalcScreenshotSize(img);

            if (imgSize.Width != img.Width)
            {
                img = Utils.ResizeImage(img, imgSize.Width, imgSize.Height);
            }

            if (_ActivityHandler != null)
            {
                _ActivityHandler.ScreenshotActionFired(img, TimingHelper.GetCurrentTimestamp());
            }

            return(img);
        }