سؤال

I am using "ImageLocation" property of PictuerBox to get a picture from the web.

PB1.ImageLocation = "http://www.example.com/picture.png"

Some times the image which has to load in picture box from web is very large in size and can not be appear instantly in PictureBox. I need to conform that Image has successfully loaded in Picturebox, before performing next operation. I have to Enable some controls just after loading of image from web.

Is there any way to conform this? (Note: My PictureBox has an initial image also.)

هل كانت مفيدة؟

المحلول

Use the PictureBox.LoadCompleted event.

نصائح أخرى

Okay see what I did for mine was just download the picture. The image normally takes a while to start getting put into the picture box.

Here is my code:

If (My.Computer.FileExists("http://www.example.com/picture.png")) Then
  My.Computer.Network.DownloadFile("http://www.example.com/picture.png", <Some Location>)
  PB1.ImageLocation = <Some location>
 Else
  End
End If

It may not be the most efficient way - but I can see it as a simple way of making it work.

Dunno if it's working or not, can't access Visual Studio at the moment

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top