Ejemplo n.º 1
0
        /// <summary>
        /// Performs the specified type of capture action and displays the image
        /// </summary>
        /// <param name="action">The action to perform</param>
        private void PerformAction(CaptureActions action)
        {
            Image image = null;

            switch (action)
            {
            case CaptureActions.Desktop:
                image = (Image)ScreenCapturing.GetDesktopWindowCaptureAsBitmap();
                break;

            case CaptureActions.Window:
                image = (Image)ScreenCapturing.GetWindowCaptureAsBitmap((int)this.Handle);
                break;

            case CaptureActions.SmallIcon:
                image = (Image)ScreenCapturing.GetWindowSmallIconAsBitmap((int)this.Handle);
                break;

            case CaptureActions.LargeIcon:
                image = (Image)ScreenCapturing.GetWindowLargeIconAsBitmap((int)this.Handle);
                break;

            default:
                // if it's clear we'll just display a null image
                break;
            }
            ;

            this.DisplayImage(image, true, PictureBoxSizeMode.Normal /* doesn't matter as audo decide sizing is enabled */);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a byte array of a bitmap for the large icon for the window specified by the handle
 /// </summary>
 /// <param name="hWnd"></param>
 /// <returns></returns>
 public static byte[] GetWindowLargeIconAsByteArray(int handle)
 {
     return(ScreenCapturing.GetBytes(ScreenCapturing.GetWindowLargeIconAsBitmap(handle)));
 }