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.