GS123
GS123

Reputation: 21

c# load image into PictureBox without slowing down UI

I am trying to load 720x480 bitmaps into a picturebox very quickly and while loading the images into the picturebox, the UI of my application slows down considerably. Is there any way around it ? I read that when using a backgroundworker, I cannot load the image into the picturebox control in the DoWork event ..

What are my options ?

Thanks

Upvotes: 2

Views: 1294

Answers (2)

Rohan West
Rohan West

Reputation: 9298

You could try using the PictureBox.LoadAsync method.

Upvotes: 1

TheVillageIdiot
TheVillageIdiot

Reputation: 40497

It depends on from where you are getting image. If it comes from network drive or from web or database then BackgroundWorker will definitely help you. Get the image in DoWork handler and assign the image to PictureBox in the RunWorkerCompleted handler.

Upvotes: 2

Related Questions