private void SnippetDialog_MouseUp(object sender, MouseEventArgs e) { _drawing = false; Hide(); //ensures border is not captured _selectedArea.Inflate(-1, -1); SnippedImage = ScreenshotProvider.TakeScreenshot(_selectedArea); DialogResult = DialogResult.OK; }
public void TakeScreenshot() { if (scenarioContext.ScenarioExecutionStatus != ScenarioExecutionStatus.OK && AqualityServices.IsApplicationStarted) { var pathToScreenshot = screenshotProvider.TakeScreenshot(); TestContext.AddTestAttachment(pathToScreenshot); AllureLifecycle.Instance.AddAttachment(pathToScreenshot, "Screenshot"); AqualityTrackingLifecycle.Instance.AddAttachment(pathToScreenshot); } }
private void CaptureActiveWindow() { IntPtr winHandle = NativeMethods.GetForegroundWindow(); NativeRectangle winRectangle; NativeMethods.GetWindowRect(winHandle, out winRectangle); Rectangle area = winRectangle.ToRectangle(); Bitmap screenshot = ScreenshotProvider.TakeScreenshot(area); ProcessScreenshot(screenshot); }
private void CaptureArea() { var screenshot = ScreenshotProvider.TakeScreenshot(SystemInformation.VirtualScreen); var dialog = new SelectAreaDialog(screenshot); if (dialog.ShowDialog() == DialogResult.OK) { Bitmap croppedScreenshot = screenshot.Clone( dialog.SelectedArea, screenshot.PixelFormat); ProcessScreenshot(croppedScreenshot); } dialog.Dispose(); }
private void CaptureFullscreen() { Bitmap screenshot = ScreenshotProvider.TakeScreenshot(SystemInformation.VirtualScreen); ProcessScreenshot(screenshot); }