Example #1
0
        /// <summary>
        ///     Create a complete screenshot of a window by using a handle.
        /// </summary>
        /// <param name="windowHandle">
        ///     Handle of the window.
        /// </param>
        /// <returns>
        ///     A <see cref="Bitmap"/> of the window.
        /// </returns>
        public static Bitmap Create(IntPtr windowHandle)
        {
            Rect window;

            NativeWin32.GetWindowRect(windowHandle, out window);
            int       winWidth   = Convert.ToInt32(window.Right - window.Left);
            int       winHeight  = Convert.ToInt32(window.Bottom - window.Top);
            Rectangle windowRect = new Rectangle((int)window.Left, (int)window.Top, winWidth, winHeight);
            Bitmap    bmpScreen  = ScreenShot.Create(windowRect);

            return(bmpScreen);
        }
Example #2
0
        /// <summary>
        ///     Create a complete screenshot of a window by using a handle.
        /// </summary>
        /// <param name="windowHandle">
        ///     Handle of the window.
        /// </param>
        /// <returns>
        ///     A <see cref="Bitmap"/> of the window.
        /// </returns>
        public static Bitmap Create(IntPtr windowHandle)
        {
            Rect window;

            User32.GetWindowRect(windowHandle, out window);
            int       winWidth   = window.Right - window.Left;
            int       winHeight  = window.Bottom - window.Top;
            Rectangle windowRect = new Rectangle(window.Left, window.Top, winWidth, winHeight);
            Bitmap    bmpScreen  = ScreenShot.Create(windowRect);

            return(bmpScreen);
        }
Example #3
0
 /// <summary>
 ///     Create a screenshot of the primary screen.
 /// </summary>
 /// <returns>
 ///		<see cref="Bitmap"/> of captured screen.
 ///	</returns>
 public static Bitmap Create()
 {
     return(ScreenShot.Create(Screen.PrimaryScreen.Bounds));
 }