For a Windows Forms application that needs the pixels currently visible on screen, create a Bitmap, obtain a Graphics surface for it, and call Graphics.CopyFromScreen. Choose the source rectangle in screen coordinates, then save or process the bitmap. If users must choose a display or application window, use Windows.Graphics.Capture: it opens secure system UI, returns capture frames, and can produce snapshots or video. Check GraphicsCaptureSession.IsSupported() before starting.
Choose the C# screenshot method
| Requirement | API | What you receive | Important behavior |
|---|---|---|---|
| Capture a known rectangle in a Windows Forms app | System.Drawing.Graphics.CopyFromScreen |
Pixels copied into a bitmap or other drawing surface | You provide source coordinates and dimensions; it captures what is visible on the desktop. |
| Let a person select a display or application window | Windows.Graphics.Capture |
Capture frames that you can turn into snapshots or streams | Uses a system picker, shows a yellow border around the captured item, and may be unavailable on some devices. |
| Take one manually without writing code | Windows Snipping Tool or Print Screen | An image copied or saved by Windows | Alt+Print Screen copies the active window; Snipping Tool supports rectangle, freeform and window modes. |
The Microsoft documentation covered here describes Windows APIs. It does not establish a cross-platform screenshot implementation for .NET, so treat these examples as Windows-specific.
Capture a screen region with CopyFromScreen
CopyFromScreen performs a bit-block transfer of color data from the screen to a drawing surface. In WinForms, the simplest pattern is to create a bitmap sized to your target rectangle, create a graphics object from that bitmap, and copy from the screen.
Complete Windows Forms example
The following method captures the rectangle occupied by a form and saves a PNG. It captures on-screen pixels, including whatever is currently covering that area; it does not re-render controls independently of the desktop.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, 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 minute#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
public static class ScreenCapture
{
public static void CaptureForm(Form form, string filePath)
{
Rectangle source = form.RectangleToScreen(form.ClientRectangle);
using Bitmap bitmap = new Bitmap(
source.Width,
source.Height,
PixelFormat.Format32bppArgb);
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.CopyFromScreen(
source.Location,
Point.Empty,
source.Size,
CopyPixelOperation.SourceCopy);
}
bitmap.Save(filePath, ImageFormat.Png);
}
}
Call it from a button or another UI event:
private void saveButton_Click(object sender, EventArgs e)
{
string path = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
"form-capture.png");
ScreenCapture.CaptureForm(this, path);
MessageBox.Show($"Saved to {path}");
}
Add using System.IO; to the form file for Path.Combine. The destination bitmap can be used directly instead of saved, for example by assigning it to a PictureBox or sending it to a print workflow.
Capture an arbitrary rectangle
Use screen coordinates for the top-left point and pass the width and height you want. This example captures a 1,280 by 720 region beginning at the primary-screen origin:
public static Bitmap CaptureRectangle(int x, int y, int width, int height)
{
Bitmap bitmap = new Bitmap(width, height);
using Graphics graphics = Graphics.FromImage(bitmap);
graphics.CopyFromScreen(
new Point(x, y),
Point.Empty,
new Size(width, height),
CopyPixelOperation.SourceCopy);
return bitmap; // caller owns and must dispose it
}
// Example:
using Bitmap shot = CaptureRectangle(0, 0, 1280, 720);
shot.Save("region.png", ImageFormat.Png);
Coordinates, multiple monitors and DPI
- Use screen coordinates: the source point is relative to the virtual desktop, not to your bitmap. A monitor positioned left of the primary display can have negative X coordinates.
- Pick dimensions deliberately: a rectangle that extends beyond available pixels can fail or produce an unusable result. Derive bounds from
Screen.AllScreensor a known window rectangle when possible. - Account for DPI: a per-monitor-DPI-aware process and a non-aware process can report different logical sizes. Keep the coordinate system consistent between the rectangle you calculate and the pixels you copy.
- Dispose resources:
BitmapandGraphicshold native resources. Useusingstatements, especially in repeated captures.
The API documentation reports a Win32Exception when the copy operation fails. Catch it at the application boundary if you need to show a recovery message or log the failing rectangle.
Rank #2
- 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
Let the user pick a window or display with Windows.Graphics.Capture
Windows.Graphics.Capture is the appropriate workflow when the user, rather than your code, chooses the target. Microsoft describes it as acquiring frames from a display or application window for snapshots or video streams. The system picker handles selection and places a yellow notification border around the item being captured.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Check support first
using Windows.Graphics.Capture;
if (!GraphicsCaptureSession.IsSupported())
{
throw new NotSupportedException(
"Windows.Graphics.Capture is not supported on this device.");
}
Support can be unavailable for several reasons, including hardware requirements. Do not treat the check as optional: provide a fallback such as CopyFromScreen for a known rectangle or explain that the feature is unavailable.
Open the system picker
The picker returns a GraphicsCaptureItem. Your capture-start method then creates the frame-pool and session appropriate to your app and converts frames to the image format you need.
Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
using Windows.Graphics.Capture;
public async Task<GraphicsCaptureItem?> PickCaptureItemAsync()
{
if (!GraphicsCaptureSession.IsSupported())
return null;
var picker = new GraphicsCapturePicker();
// In WinUI 3, initialize the picker with your window handle
// before calling PickSingleItemAsync().
return await picker.PickSingleItemAsync();
}
private async void pickButton_Click(object sender, RoutedEventArgs e)
{
GraphicsCaptureItem? item = await PickCaptureItemAsync();
if (item is null)
return; // user cancelled the picker
StartCapture(item); // create your frame pool and session here
}
The WinUI 3 handle initialization is specific to WinUI 3. Do not copy it as a universal requirement for every C# UI framework. A picker cancellation returns no item, so leave the current state unchanged rather than starting a session with a null target.
Frames versus a single image
Windows.Graphics.Capture supplies frames; it is not a one-line SavePng call. A typical implementation creates a Direct3D11CaptureFramePool, starts a GraphicsCaptureSession, handles frame-arrived events, copies the selected frame into a texture or bitmap, and encodes that image as PNG or JPEG. Keep the session alive for continuous capture and stop it when the window closes. For a single screenshot, take the first complete frame, encode it, then dispose the pool and session.
Manual screenshots when no code is needed
For a person taking a screenshot rather than an application capturing one, Windows includes Snipping Tool and Print Screen. Alt+Print Screen copies the active window. Snipping Tool can launch interactive rectangle, freeform and window capture modes; its documented image-capture launch requires exactly one mode parameter. This is often faster than adding a capture dependency to a utility that only needs occasional images.
Rank #4
- 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.
Or skip the browser setup
If your real goal is to capture a web page—not the local desktop—ScreenshotNeo returns a PNG, JPEG, WebP or PDF from one HTTP request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
C# with HttpClient
using System.Net.Http;
using HttpClient http = new HttpClient
{
Timeout = TimeSpan.FromSeconds(90)
};
string endpoint = "https://api.screenshotneo.com/v1/shot" +
"?access_key=YOUR_API_KEY" +
"&url=https%3A%2F%2Fstripe.com";
byte[] bytes = await http.GetByteArrayAsync(endpoint);
await File.WriteAllBytesAsync("shot.webp", bytes);
See the ScreenshotNeo API documentation for parameters such as full-page capture, CSS selectors, device presets, custom JavaScript, waits, blocking rules, cookies, headers, geolocation, PDF settings, caching, signed links, asynchronous webhooks and bulk capture.
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Every feature is included on every plan. The Free plan provides 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up free to get started.
Troubleshooting checklist
CopyFromScreen throws a Win32Exception
- Log the source rectangle and verify its width and height are positive.
- Confirm coordinates are desktop coordinates, including negative values for monitors placed left or above the primary display.
- Retry after the target window or display is available; handle the exception instead of assuming every desktop can be captured.
The image is blank or captures the wrong area
- Ensure the source rectangle is in screen coordinates, not client coordinates. Convert a WinForms client rectangle with
RectangleToScreen. - Check DPI awareness when logical bounds do not match physical pixels.
- Remember that
CopyFromScreencopies visible pixels; an obscured or minimized window will not be reconstructed.
The picker is unavailable
- Call
GraphicsCaptureSession.IsSupported()and provide a fallback path. - Handle picker cancellation by checking for a null item.
- Verify the target is a supported Windows desktop device or Windows Mixed Reality immersive headset; the cited guidance does not establish support for other platforms.
Capture works once but leaks memory
Dispose every bitmap, graphics surface, frame, frame pool and session when finished. For repeated captures, reuse a correctly sized buffer where your chosen frame-processing design permits it, and stop capture during form shutdown.
Best Value
- 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.
Practical decision guide
- Use
CopyFromScreenwhen your WinForms code already knows the rectangle and you need a straightforward still image. - Use
Windows.Graphics.Capturewhen a user must select a window or display, or when you need a stream of frames. - Use Snipping Tool or Print Screen for an occasional human-operated screenshot.
- Use ScreenshotNeo for automated web-page images, PDFs, clean consent-free output or AI-agent workflows rather than local desktop pixels.
Frequently Asked Questions
Can CopyFromScreen capture a minimized window?
No. It copies pixels currently present in the desktop rectangle, so a minimized or covered window is not rendered as if it were visible.
Does Windows.Graphics.Capture work on every Windows installation?
No. Call GraphicsCaptureSession.IsSupported() and handle unsupported hardware or environments.
Which format should I save for screenshots?
PNG preserves lossless UI text and transparency; JPEG is smaller for photographic content. Choose the encoder based on the image rather than the capture API.
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.




