Esempio n. 1
0
        private Screenshot TakeScreenshot()
        {
            var rect = new User32.Rectangle();

            User32.GetWindowRect(_windowsProcess.MainWindowHandle, ref rect);
            var bitmap = new System.Drawing.Bitmap(_userProcess.Width, _userProcess.Height, PixelFormat.Format32bppArgb);

            #region Debug
            //"Capturando tela...".LogLine();
            //    bitmap.Save($"{Directory.GetCurrentDirectory()}\\SCREEN.png", ImageFormat.Png);
            #endregion

            return(new Screenshot(bitmap, rect));
        }
        public RepositionWindowInfo(WindowInfo toPosition)
        {
            ToPosition = toPosition;

            _originalVisible = toPosition.IsVisible();
            Visible          = _originalVisible;

            var placement = new User32.WindowPlacement();

            User32.GetWindowPlacement(toPosition.Handle, ref placement);

            User32.Rectangle position = placement.NormalPosition;
            _originalX = position.Left;
            X          = _originalX;
            _originalY = position.Top;
            Y          = _originalY;
            // TODO: According to the documentation, the pixel at (right, bottom) lies immediately outside the rectangle. Do we need to subtract with 1?
            _originalWidth  = position.Right - position.Left;
            Width           = _originalWidth;
            _originalHeight = position.Bottom - position.Top;
            Height          = _originalHeight;
        }
Esempio n. 3
0
 public Screenshot(Bitmap image, User32.Rectangle rectangle)
 {
     Bitmap    = image;
     Rectangle = rectangle;
 }