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 8044853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:21:41+00:00 2026-06-05T05:21:41+00:00

I have a Winform with 4 PictureBox controls, each control will contain a diferent

  • 0

I have a Winform with 4 PictureBox controls, each control will contain a diferent image. The process is:

An event x is raised, the eventargs from this event, contain the filenames of each image (4), an so on (file exists etc..). Then, I have to update the UI.

Commonly I use Invoke:

Invoke((ThreadStart)delegate()
{
    picBig.Image = new Bitmap(strImageBig);
    picLittle1.Image = new Bitmap(saLittle[0]);
    picLittle2.Image = new Bitmap(saLittle[1]);
    picLittle3.Image = new Bitmap(saLittle[2]);
});

// saLittle[] is a string array, contains, filenames: "image1.jpg"

But when this executes, the form freezes for a little time, about 500ms, I know it’s a small interval but it’s noticeable, then the app continues normally.

I was trying to find out the reason of that ‘UI freeze’, then, after research, I found BeginInvoke. Now my code looks like this:

BeginInvoke((MethodInvoker)delegate
{
    picBig.Image = new Bitmap(strImageBig);
    picLittle1.Image = new Bitmap(saLittle[0]);
    picLittle2.Image = new Bitmap(saLittle[1]);
    picLittle3.Image = new Bitmap(saLittle[2]);
});

This is a little faster. But the UI is still freezing for 200~300ms.

In the articles I’ve read, they say that BeginInvoke is a better way than Invoke.

The code is working OK, there is no problem with logic or anything else. I just want to know why this happens. I don’t want to leave this doubt unclear. The project is already finished. Hope this be useful for someone else.

Maybe this is not the correct approach. I know there are many ways to update the UI from a background thread, but is there another way to make an update faster?

Or, do you think, the image loading is the reason? Is there another way to do a faster loading of images?

Thanks in advance.

  • 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-05T05:21:43+00:00Added an answer on June 5, 2026 at 5:21 am

    This is because you’re actually loading your images from disk on the UI thread along with setting the contents of the control. Calling the Bitmap constructor with a file path will go to the hard drive and load the image into memory.

    Invoke and BeginInvoke will run the delegate that you provide on the thread that the control was created on, which is most likely going to be the UI thread.

    …but is there another way to make an update faster?

    Load the images on your background thread and, when they’re actually loaded, invoke and set the images into the controls.

                        var big = new Bitmap(strImageBig);
                        var little1 = new Bitmap(saLittle[0]);
                        var little2 = new Bitmap(saLittle[1]);
                        var little3 = new Bitmap(saLittle[2]);
    
                        Invoke((ThreadStart)delegate()
                        {
                            picBig.Image = big;
                            picLittle1.Image = little1;
                            picLittle2.Image = little2;
                            picLittle3.Image = little3;
                        });                    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a winform application I have WebBrowser control and a PictureBox . I am
I have a winform with preloaded DataGridView over it...I want to remove rows from
I have applications(WinForm) that gets some objects from webservice. After receiving array I transform
I have a PictureBox (WinMobile 6 WinForm) on which I draw some images. There
i will show you an image below but before that... if you have seen
I have WinForm controls I want to put in a WPF DropDownButton s(Extended WPF
I have a winform with 2 WebBrowser control. Is there a way for one
I have a WinForm application, I'm trying to move a pictureBox in a Form
I have two controls which are both contained within a user control. Panel location:
I have a winform and a WebBrowser control and I am changing an option

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.