Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:59:29+00:00 2026-06-15T18:59:29+00:00

I have some c# experiece, but I’m new to WinForms. I have a method

  • 0

I have some c# experiece, but I’m new to WinForms.

I have a method that takes a screenshot as a BitMap:

public Bitmap GetSreenshot() 
{
    Rectangle bounds = Screen.PrimaryScreen.Bounds;

    Bitmap bmp = new Bitmap(bounds.Width, bounds.Height,
        PixelFormat.Format32bppArgb);

    Graphics gfx = Graphics.FromImage(bmp);

    gfx.CopyFromScreen(bounds.X,
                                   bounds.Y,
                                   0,
                                   0,
                                   bounds.Size,
                                   CopyPixelOperation.SourceCopy);

    return bmp; 
} 

My problem is that I’m using this in a timer with an interval of ~100ms. Every time a screenshot is taken, I can notice that the UI thread is affected (lag when moving the form etc).

Is there any way to generate the screenshot on another thread so that it wont affect the UI? I’ve read something about BackgroundWorker, is that the way to go? I would appreciate if someone could point me in the right direction here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:59:30+00:00Added an answer on June 15, 2026 at 6:59 pm

    From comment to answer:

    Background worker is one way to go, but you could also look into Task Parallel Library (Task and Task<>), if .NET 4.0 is available to you. .NET 4.5 also supports the async/await pattern which can be usefull.

    Task parallel library replacement for BackgroundWorker? and this http://msmvps.com/blogs/brunoboucard/archive/2010/11/06/parallel-programming-with-c-4-0-part-3.aspx will provide further information

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, i have some experience with MVC. but I'm new to rails. I'm using
I am a bit new with android but I have some java experience. So
I'm new to Java, but have some OOP experience with ActionScript 3, so I'm
I'm pretty new to Android but I have some experience (and a bit rusty
I am new to mobile development, but have some experience with web app development.
I'm new to NAnt but have some experience with Ant and CruiseControl. What I
Kinda new to Silverlight and have some experience with WPF but I'm doing a
Ok, so I am very new to android but I have some experience with
I'm quite new to Android but already have some experience with Java itself. Now
I am quite new to programming in Java, but I have some experience in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.