Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
C++

How to Take Desktop Screenshots in C# on Windows

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a simple screenshot of a known screen rectangle in a Windows desktop app, create a Bitmap, get a Graphics object from it, and call Graphics.CopyFromScreen. If the user should choose a display or application window through Windows’ capture interface, use Windows.Graphics.Capture instead. These are Windows APIs, not cross-platform C# screenshot methods.

The examples below focus on a Windows Forms app for direct screen copying and explain the additional capture pipeline required for the modern picker API. They distinguish a one-time still image from repeated frame capture, and show how to save a bitmap as PNG.

How do I take a screenshot in C#?

Choose the capture API according to who selects the target. CopyFromScreen is the direct option when your program already knows the screen coordinates and dimensions to copy. Windows.Graphics.Capture is designed for a user to select a display or app window using secure Windows system UI.

What you need Starting point Important qualification
Copy a known rectangle into an image in a Windows Forms app System.Drawing.Graphics.CopyFromScreen Coordinates are screen-space for the source and bitmap-space for the destination. The call can fail with Win32Exception.
Let the user select a display or app window Windows.Graphics.Capture with GraphicsCapturePicker Check runtime support and, in WinUI 3, initialize the picker with the desktop app’s window handle.
Capture successive frames for a stream or recording Windows.Graphics.Capture frame pool and session This is a recurring frame-capture pipeline, not just a single bitmap operation.

The Windows Forms example in Microsoft’s How to print a Windows Form documentation uses CopyFromScreen to copy a form-sized region into a bitmap. That demonstrates the API, but a form’s visible screen bounds and a general-purpose capture design are separate concerns: use the rectangle that matches the result your program actually needs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

How do I capture the whole screen in C#?

For the primary display in a Windows Forms application, use its bounds as the source rectangle. The screen origin can be negative in multi-monitor arrangements, so do not assume that the upper-left corner is always (0, 0). The resulting bitmap represents the primary display only; capturing every attached display requires deciding how to combine their individual bounds and handling any gaps in the virtual desktop.

using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

static Bitmap CapturePrimaryScreen()
{
    var bounds = Screen.PrimaryScreen.Bounds;
    var bitmap = new Bitmap(bounds.Width, bounds.Height);

    using (var graphics = Graphics.FromImage(bitmap))
    {
        graphics.CopyFromScreen(
            bounds.Location, // upper-left source point in screen coordinates
            Point.Empty,      // upper-left destination point in the bitmap
            bounds.Size);     // width and height to copy
    }

    return bitmap; // The caller owns and must dispose this bitmap.
}

using (var screenshot = CapturePrimaryScreen())
{
    screenshot.Save("screenshot.png", ImageFormat.Png);
}

This is a Windows Forms-oriented example using System.Drawing and Screen. Target a Windows desktop framework and include the framework references appropriate to the project; this is not a portable .NET example for macOS or Linux. The returned bitmap remains the caller’s responsibility, so dispose it when finished.

For a multi-monitor desktop, enumerate the displays and inspect each display’s bounds rather than treating the primary display as the whole desktop. A single bitmap covering the virtual desktop can include empty space where monitor layouts do not occupy every point of the bounding rectangle. The desired output—one image per display or one combined image—determines the sensible approach.

Rank #2
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
  • 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
  • 4GB DDR4 System Memory; 128GB Solid State Drive
  • 11.6" HD (1366 x 768) Multi-Touch Display
  • Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
  • Windows 11 Pro

How do I capture a window or a selected area?

Copy a known area with CopyFromScreen

The method takes three pieces of information: the source point on the screen, the destination point on the drawing surface, and the size of the rectangle. For the common case of a new bitmap, the destination point is Point.Empty, or (0, 0).

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
using System.Drawing;

static Bitmap CaptureRegion(Point screenOrigin, Size size)
{
    var bitmap = new Bitmap(size.Width, size.Height);
    using (var graphics = Graphics.FromImage(bitmap))
    {
        graphics.CopyFromScreen(screenOrigin, Point.Empty, size);
    }
    return bitmap; // Caller must dispose it.
}

For example, call CaptureRegion(new Point(120, 90), new Size(800, 600)) to copy an 800-by-600-pixel rectangle whose screen-space top-left is at (120, 90). Replace those coordinates and dimensions with values appropriate to the actual desktop and target. A selected-area tool must first obtain the user’s selection rectangle, then pass its screen-space origin and size to this method.

Copying a window by its current screen rectangle is still copying pixels from the screen. The window needs to be positioned and visible as intended, and overlapping content or a window partly outside the desktop can affect the copied result. If exact user-mediated selection of an app window is important, prefer the capture picker below rather than presenting coordinate copying as equivalent.

Rank #3
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

Let the user choose a display or app window

Windows.Graphics.Capture provides system UI for selecting a display or application window. Windows draws a yellow notification border around the actively captured item. Microsoft documents support on Windows desktop devices and Windows Mixed Reality immersive headsets; this should not be described as support for every platform that can run C#.

The implementation sequence is:

  1. Check GraphicsCaptureSession.IsSupported() and do not offer capture when it returns false.
  2. Create a GraphicsCapturePicker. In WinUI 3, initialize it with the owning desktop window handle before showing it.
  3. Await PickSingleItemAsync(). If the returned item is null, treat that as user cancellation and stop without starting capture.
  4. Use the selected GraphicsCaptureItem to create a Direct3D11CaptureFramePool and a capture session.
  5. For a still screenshot, obtain and process a frame into the image representation your app needs. For ongoing capture, handle successive frames and their lifetime as a frame pipeline.

The picker alone does not produce a saved PNG. It identifies the selected capture item; frame-pool setup, reading the frame, transferring or converting its pixels, and saving the result are additional work. Microsoft’s Windows capture guide demonstrates an 8-bit BGRA format for standard dynamic range (SDR). The precise interop and bitmap-saving code depends on the desktop framework and graphics pipeline, so do not treat the short picker sequence as a complete still-image implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I save a screenshot as a PNG?

Once you have a Bitmap, save it with ImageFormat.Png. The examples above use a relative filename, which writes relative to the process’s current working directory; use an explicit path if the file must go somewhere predictable.

Rank #4
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
using System.Drawing.Imaging;

using (var screenshot = CaptureRegion(new Point(120, 90), new Size(800, 600)))
{
    screenshot.Save(@"C:Screenshotsregion.png", ImageFormat.Png);
}

Make sure the destination directory exists and that the process has permission to write there. Keep the bitmap alive until Save completes, then dispose it. If the capture routine throws, it will not reach the save call; handle the capture failure separately from filesystem errors so the user can tell which step failed.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Still snapshots, repeated capture, and HDR

A single still image

A CopyFromScreen call copies screen pixels into a drawing surface at the time it runs. It is a natural fit for a one-off still of a known region. If the user chooses a target through Windows.Graphics.Capture, you still need to retrieve a frame and convert or transfer it to the image type you plan to save.

Repeated frames

For a stream or recording, use the frame-pool and capture-session model in Windows.Graphics.Capture. A recurring pipeline must process successive frames rather than assume that a one-time bitmap call will provide ongoing updates. Plan for frame processing and disposal, and avoid blocking the UI while doing longer-running work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.

HDR content

The basic BGRA 8-bit example is aimed at SDR. Microsoft cautions that on systems with Windows HD Color enabled, HDR content may not use that 8-bit format; it can appear washed out or clipped when forced through an SDR-oriented destination. For an HDR-aware pipeline, Microsoft advises considering DXGI_FORMAT_R16G16B16A16_FLOAT consistently through capture and destination handling, with appropriate HDR saving or HDR-to-SDR tone mapping where required. This is an HDR-specific concern, not a prerequisite for a basic SDR screenshot.

Common problems and fixes

  • The captured rectangle is offset or cropped. Check that the source point is in screen coordinates, the destination point is in bitmap coordinates, and the size fits the bitmap. Use actual display bounds rather than assuming the desktop begins at (0, 0).
  • CopyFromScreen fails. Microsoft documents that the operation can throw Win32Exception. Catch and report capture failures instead of assuming the screen copy succeeded; verify the requested rectangle and the desktop state before retrying.
  • The capture picker is unavailable. Call GraphicsCaptureSession.IsSupported() and handle unsupported environments without opening the picker.
  • The WinUI 3 picker does not open correctly. Initialize GraphicsCapturePicker with the owning window handle as required for a desktop app before calling PickSingleItemAsync().
  • No item was selected. A null result from PickSingleItemAsync() represents cancellation. Return to the application without creating a session or trying to save a nonexistent frame.
  • The image looks washed out. If the source is HDR, check whether the pipeline is forcing it into 8-bit BGRA. Use consistent HDR-capable pixel formats and appropriate output conversion when fidelity is required.
  • The PNG is missing. Check the path, directory existence, and write permissions, and distinguish save exceptions from capture exceptions.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a Windows desktop capture API; use the C# methods above for local desktop pixels. For capturing a web page by URL instead, one GET request can return an image or PDF. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie banners and consent overlays, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
  • Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Response headers identify the page verdict and billing outcome.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to try web-page captures. ScreenshotNeo is made by Yorker Media; see ScreenshotNeo.

Frequently Asked Questions

Does Graphics.CopyFromScreen capture a window that is minimized?

No guarantee is established for minimized-window content: CopyFromScreen copies pixels from the screen area, rather than rendering a hidden window independently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use these methods to capture a browser page from a URL?

Not with the desktop APIs shown here. They capture pixels from the Windows desktop; URL-based page rendering is a different task.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$249.99
Bestseller No. 2
Dell Latitude 3190 11.6' HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core; 4GB DDR4 System Memory; 128GB Solid State Drive
$179.99
Bestseller No. 3
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$304.99

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.