Example #1
0
        public void EnableDesktopFeatures(bool Enabled)
        {
            //Disable components from the desktop
            if (DisabeAERODesktop)
            {
                //Disable the aero desktop
                ScreenOperations.DwmEnableComposition(Enabled);
            }

            //string wallpaperPath = String.Empty;
            if (DisableWallpaper)
            {
                if (!Enabled)
                {
                    //Get wallpapper
                    _wallpaperPath = ScreenOperations.GetWallpaper();
                    //Set black wallpaper
                    ScreenOperations.SetWallpaper(String.Empty);
                }
                else
                {
                    //Return to the default wallpaper
                    ScreenOperations.SetWallpaper(_wallpaperPath);
                }
            }
        }
Example #2
0
        /// <summary> Performs a sequence of screen captures </summary>
        /// <para>* This function is hand-written for a particular scenario and it is only interesting for the bits of code inside, not so much for reuse</para>
        static void SequencedCapture()
        {
            for (int i = 0; i < 200; i++)
            {
                ScreenOperations.ImageSave("%NOW%"
                                           , System.Drawing.Imaging.ImageFormat.Png
                                           , ScreenOperations.CaptureWindow(80, 297, 2040, 2850));

                System.Threading.Thread.Sleep(2000);
                MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftDown);
                MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftUp);
            }
        }
Example #3
0
        public void CaptureScreen()
        {
            //Bitmap to store the image
            Bitmap memoryImage = ScreenOperations.CaptureScreen(true);
            //Get the encoder
            ImageCodecInfo encoder = GetEncoder(_imageFormat);

            if (encoder != null)
            {
                //Set the parameters of'
                EncoderParameters encoderParameters = new EncoderParameters(1);
                EncoderParameter  encoderParameter  = new EncoderParameter(Encoder.Quality, _imageQuality);
                encoderParameters.Param[0] = encoderParameter;
                // Save the image using this encoder parameter
                memoryImage.Save(ImagePath + "\\" + _prefixImageName + "_" + DateTime.UtcNow.ToString("yyyyMMddHHmmssfff") + "." + _imageFormat.ToString().ToLower(), encoder, encoderParameters);
            }
            else
            {
                //Save withount enconde the image
                memoryImage.Save(ImagePath + "\\" + _prefixImageName + "_" + DateTime.UtcNow.ToString("yyyyMMddHHmmssfff") + "." + _imageFormat.ToString().ToLower(), _imageFormat);
            }
        }