예제 #1
0
        public static Bitmap CapturarW10(IntPtr handle)
        {
            var rect = new User32.RECT();

            User32.GetWindowRect(handle, ref rect);

            // Ajustamos los bordes invisibles de W10
            rect.Bottom -= 8;
            rect.Left   += 8;
            rect.Right  -= 8;
            rect.Top    += 1;

            var bounds = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
            var result = new Bitmap(bounds.Width, bounds.Height);

            using (var graphics = Graphics.FromImage(result))
            {
                graphics.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
            }

            return(result);
        }
예제 #2
0
 public static bool MoverVentana(IntPtr handle, int width, int height)
 {
     User32.RECT r = new User32.RECT();
     User32.GetWindowRect(handle, ref r);
     return(User32.MoveWindow(handle, r.Left, r.Top, width, height, true));
 }