Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteFor a simple screenshot of a known screen rectangle in a Windows Forms app, create a Bitmap, create a Graphics object from it, and call CopyFromScreen. To let a person select a display or application window using Windows system UI, use Windows.Graphics.Capture instead. These are Windows desktop approaches, not cross-platform C# APIs.
The examples below focus on Windows Forms and SDR screenshots. The Windows capture picker is a separate, more involved option for modern Windows apps; it requires runtime support and, in WinUI 3, initialization with the app window handle.
How do I take a screenshot in C#?
Choose the capture API based on who decides what is captured:
| Need | Starting point | Important constraint |
|---|---|---|
| Copy a known screen rectangle into an image in a Windows Forms app | System.Drawing.Graphics.CopyFromScreen |
Supply the rectangle’s screen coordinates and size correctly. The operation can fail with a Win32Exception. Microsoft API reference |
| Let the user choose a display or app window through Windows UI | Windows.Graphics.Capture and GraphicsCapturePicker |
Check support at runtime. Windows displays a yellow border around the actively captured item. Microsoft screen capture guide |
| Capture a Windows Forms window in a documented printing scenario | Microsoft’s form-to-bitmap example using CopyFromScreen |
It demonstrates copying a form-sized screen region for printing; it is not a universal capture architecture. Microsoft form printing example |
The examples are for Windows desktop applications. The WinForms sample assumes a Windows Forms project with the relevant Windows desktop targeting and System.Drawing framework/package setup; it is not a general cross-platform screenshot solution. The picker workflow is for Windows.Graphics.Capture and its supported Windows devices, not macOS or Linux.
#1 Best Overall
- Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
How do I capture the whole screen in C#?
Use the bounds of the display you intend to capture, then pass its top-left screen coordinate and dimensions to CopyFromScreen. This example captures the primary display in a Windows Forms app and saves a PNG when the user clicks a button. It is a still snapshot, not a recurring video/frame-capture loop.
Windows Forms example: capture the primary display
Create a Windows Forms project targeting Windows. Put this code in the form class (or adapt the handler into your form). It assumes the form has a button named captureButton; wire its Click event to CaptureButton_Click, for example in the form constructor.
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
captureButton.Click += CaptureButton_Click;
}
private void CaptureButton_Click(object? sender, EventArgs e)
{
var screen = Screen.PrimaryScreen;
if (screen is null)
{
MessageBox.Show("No primary display is available.");
return;
}
var bounds = screen.Bounds;
using var bitmap = new Bitmap(bounds.Width, bounds.Height);
using (var graphics = Graphics.FromImage(bitmap))
{
graphics.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size);
}
bitmap.Save("screenshot.png", ImageFormat.Png);
}
}
The source point (bounds.Location) is the upper-left screen coordinate; Point.Empty is the upper-left destination coordinate within the new bitmap; and bounds.Size is the region copied. The destination bitmap starts at (0, 0), even if the display’s screen origin is not (0, 0).
Rank #2
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Screen.PrimaryScreen intentionally selects just the primary display. For another display, use that display’s bounds. For a multi-display capture, determine the intended combined bounds rather than assuming monitors form a particular geometry: displays can occupy different positions relative to one another. A single bitmap spanning the combined rectangle can include areas without a display where the layout has gaps.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsThe bitmap and graphics object are disposed with using. If you return a bitmap from a helper method instead of saving it inside the method, the caller owns it and must dispose it. Microsoft’s CopyFromScreen API transfers screen pixel color data to a drawing surface and documents that it can throw Win32Exception if the copy fails.
How do I capture a window or a selected area?
Capture a known rectangle with CopyFromScreen
For a selected rectangular area whose screen coordinates and size are already known, use the same three arguments. This helper returns the captured bitmap; the caller must dispose it after saving or using it.
Rank #3
- Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
- 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
- ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
- ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
- ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
using System.Drawing;
static Bitmap CaptureRegion(Point screenOrigin, Size size)
{
var bitmap = new Bitmap(size.Width, size.Height);
try
{
using var graphics = Graphics.FromImage(bitmap);
graphics.CopyFromScreen(screenOrigin, Point.Empty, size);
return bitmap; // The caller owns and must dispose this bitmap.
}
catch
{
bitmap.Dispose();
throw;
}
}
Pass the upper-left source point in screen coordinates and the width and height of the desired rectangle. Validate that the dimensions are positive before creating the bitmap, and handle capture failure at the call site. For a form-sized capture, Microsoft’s documented example uses the form’s location and size with CopyFromScreen; that is useful as an illustration, but copying visible screen pixels is different from rendering an off-screen or occluded window’s contents.
Let the user choose a display or app window
For modern Windows applications where the user should choose what to capture, use Windows.Graphics.Capture. Microsoft describes it as an API for acquiring frames from a display or app window and using them for snapshots or video streams. The system picker lets the user select the item; a yellow notification border identifies the actively captured item. Microsoft’s documented support scope is Windows desktop devices and Windows Mixed Reality immersive headsets. Check GraphicsCaptureSession.IsSupported() before offering this feature.
- Check
GraphicsCaptureSession.IsSupported(); if it returns false, do not present the picker workflow as available. - Create a
GraphicsCapturePicker. In WinUI 3, initialize it with the owning desktop window handle before opening it, as required by the picker API. - Await
PickSingleItemAsync(). If it returns null, the user cancelled or did not choose an item; treat that as cancellation rather than a capture error. - Use the returned
GraphicsCaptureItemto create aDirect3D11CaptureFramePooland capture session, then obtain frames and convert or save them through your application pipeline.
This is not a one-call replacement for the WinForms bitmap example: the picker is the selection step, while frame-pool/session setup and image handling are additional parts of the capture pipeline. Microsoft’s sample chooses an 8-bit BGRA normalized format for SDR. The picker API was introduced in Windows 10 version 1803; still check runtime support rather than relying only on a compile-time target. Microsoft GraphicsCapturePicker reference
Rank #4
- Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
- Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
- Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
- EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
- Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.
How do I save a screenshot as a PNG?
For a System.Drawing.Bitmap, call Save with a path and ImageFormat.Png:
using var bitmap = CaptureRegion(new Point(100, 100), new Size(800, 600));
bitmap.Save("region.png", System.Drawing.Imaging.ImageFormat.Png);
The path above is relative to the process’s current working directory. For an application users can run from different locations, choose an explicit destination they can access rather than assuming the executable’s directory is writable. Keep the bitmap alive through the save operation, then dispose it. PNG is suitable when you want a lossless image; the cited API material establishes how to save the bitmap but does not make claims about resulting file size or capture speed.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What changes for HDR or recurring capture?
HDR capture needs a matching pipeline
This walkthrough is SDR-focused. Microsoft’s Windows.Graphics.Capture guide warns that when Windows HD Color is enabled, captured content may not use the 8-bit BGRA format; using that format for HDR content can produce washed-out results. For HDR, Microsoft advises considering DXGI_FORMAT_R16G16B16A16_FLOAT consistently through the capture pipeline and destination, with HDR-capable saving or HDR-to-SDR tone mapping as needed. Do not treat that as a requirement for an ordinary SDR screenshot. Microsoft HDR guidance
Best Value
- Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
A still image is not a capture stream
The button example takes one snapshot. If the requirement is repeated frames or video, Windows.Graphics.Capture’s frame-pool/session approach is the relevant model; it produces frames that your app must continue to process and save or encode. That ongoing pipeline has different lifecycle and performance considerations from allocating one bitmap and saving one PNG.
Troubleshooting C# desktop screenshots
- The image is the wrong area or shifted. Check that the source point is in screen coordinates, the destination point is bitmap-relative (usually
Point.Empty), and the size is the intended rectangle. Do not substitute a form’s client-area dimensions for a different screen rectangle without accounting for that difference. - The app throws Win32Exception during CopyFromScreen. The API documents this failure possibility. Catch the exception at the capture boundary, report that the screen copy failed, and let the user retry or choose another capture method; do not assume an allocated bitmap means capture succeeded.
- No display bounds are available. Check the primary-display result before dereferencing it, as the example does. If the app supports selecting displays, handle the absence of a selected display explicitly.
- The picker does not open correctly in WinUI 3. Initialize
GraphicsCapturePickerwith the desktop app’s owner window handle before invoking the picker. The requirement is specific to desktop app window ownership; do not omit the setup. - The picker returns no item. Treat a null result as user cancellation and stop before creating the frame pool or capture session.
- The picker option is unavailable. Check
GraphicsCaptureSession.IsSupported()at runtime and offer an appropriate fallback, such as a known-rectangle capture where that fits the app’s needs. - HDR content looks washed out. Review the capture pixel format and destination path together. The basic 8-bit BGRA SDR choice may not preserve HDR fidelity; use an HDR-aware format and saving or tone-mapping pipeline as appropriate.
- The PNG save fails. Check the output path and write permissions, and ensure the bitmap has not already been disposed. Prefer a user-accessible destination over an assumed writable working directory.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server, not a Windows desktop-display capture API. Use it when the target is a webpage URL; it does not replace CopyFromScreen or Windows.Graphics.Capture for capturing your desktop. A one-request webpage capture looks like this:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. It removes cookie banners, newsletter popups and chat widgets before a shot; bot checks, blank pages and failed loads are never billed. Its MCP server provides screenshot tools for AI agents. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Learn about ScreenshotNeo.
Sign up free for 1,000 screenshots a month, with no card required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

