/// <summary> /// This method will use User32 code to capture the specified captureBounds from the screen /// </summary> /// <param name="capture">ICapture where the captured Bitmap will be stored</param> /// <param name="captureBounds">Rectangle with the bounds to capture</param> /// <returns>A Capture Object with a part of the Screen as an Image</returns> public static ICapture CaptureRectangle(ICapture capture, Rectangle captureBounds) { if (capture == null) { capture = new Capture(); } Image capturedImage = null; // If the CaptureHandler has a handle use this, otherwise use the CaptureRectangle here if (CaptureHandler.CaptureScreenRectangle != null) { try { capturedImage = CaptureHandler.CaptureScreenRectangle(captureBounds); } catch { } } // If no capture, use the normal screen capture if (capturedImage == null) { capturedImage = CaptureRectangle(captureBounds); } capture.Image = capturedImage; capture.Location = captureBounds.Location; return(capture.Image == null ? null : capture); }
/// <summary> /// Make Capture with default destinations /// </summary> /// <param name="mode">CaptureMode</param> /// <param name="captureMouseCursor">bool false if the mouse should not be captured, true if the configuration should be checked</param> public void MakeCapture(CaptureMode mode, bool captureMouseCursor, CaptureHandler captureHandler) { Capture passingCapture = new Capture(); passingCapture.CaptureDetails.CaptureHandler = captureHandler; MakeCapture(mode, captureMouseCursor, passingCapture); }
/// <summary> /// Make capture of window /// </summary> /// <param name="window">WindowDetails of the window to capture</param> /// <param name="captureMouseCursor">bool false if the mouse should not be captured, true if the configuration should be checked</param> public void MakeCapture(WindowDetails window, CaptureHandler captureHandler) { Capture passingCapture = new Capture(); passingCapture.CaptureDetails.CaptureHandler = captureHandler; selectedCaptureWindow = window; MakeCapture(CaptureMode.ActiveWindow, false, passingCapture); }