© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
206 replies
exergist

✅ Quicker Screenshot

I'm trying to quickly capture a screenshot. My current method (when capturing the entirety of a 3440x1440p screen) takes about 60-80ms:

// Capture screenshot
static System.Drawing.Bitmap GetScreenshot(System.Drawing.Rectangle bounds = default)
{
    if (bounds == default)
        bounds = Screen.GetBounds(System.Drawing.Point.Empty);

    System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(bounds.Width, bounds.Height);
    using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
    {
        g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
    }
    return bitmap;
}
// Capture screenshot
static System.Drawing.Bitmap GetScreenshot(System.Drawing.Rectangle bounds = default)
{
    if (bounds == default)
        bounds = Screen.GetBounds(System.Drawing.Point.Empty);

    System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(bounds.Width, bounds.Height);
    using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
    {
        g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
    }
    return bitmap;
}


Capturing a smaller region of the screen (via
bounds
bounds
) definitely helps. Thanks!!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

All Monitor ScreenShot
C#CC# / help
2y ago
Screenshot and save to file
C#CC# / help
2y ago
❔ How to get screenshot using C#
C#CC# / help
3y ago
Next page