We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cancel PictureBox Loading

Sorry about the vague control tag, I couldn't find PictureBox in the list.

I'm fairly new to windows forms, so I'm still learning, but I've made a gallery/slideshow program that simply works by changing the ImageLocation of a PictureBox (remotely stored images loaded from a link) when either the left or right arrow key is pressed. I have preview images and hi-res images, so I can load the preview one first (it's almost instant), then have a LoadCompleted event handler check if the image loaded was indeed preview, and load a hires one if it is (which takes about 2-3 seconds, though on occasion much longer).

My problem comes from the user switching between slides while the hires image is still loading. What happens is the new preview image doesn't show up because the previous image is still loading. Even after the previous image is done loading, the preview image doesn't show up, I guess because the hires one was the one that loaded last.

I need a way to abort the image loading so I can immediately display the preview image without the previous hires one taking priority. I've tried putting LoadAsync and CancelAsync to use but still, when the hires image finishes loading it remains displayed instead of the new preview one. Maybe I'm just using them incorrectly? I hope someone can help me out.

1 Reply

SG Santhosh Govindasamy Syncfusion Team May 1, 2023 02:27 PM UTC

Hi lumine,

Could you please provide the name of the Syncfusion control that you have used? This information could be helpful for us to check and provide you with required solution.



Live Chat Icon For mobile
Up arrow icon