PictureBox.LoadAsync Method (String)
Loads the image at the specified location, asynchronously.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
If the url parameter indicates a local file, the recommended format is a local file path. For example, an image file named myPicture.jpglocated atc:\ would be accessed by passing c:\myPicture.jpg for the url parameter. A full path, such as http://www.contoso.com/path/images/image.jpg, or a relative path, such as ./images/image.jpg, can be used. If a relative path is used, it will be considered relative to the working directory. A call to the Load method sets the ImageLocation property to the value of url.
A call to the ImageLocation property to the value of url. Besides calling the LoadAsync method, you must set the WaitOnLoad property to false to load an image asynchronously. When you load an image asynchronously, you can handle the LoadProgressChanged event to determine the progress of an image load or the LoadCompleted event to determine when an image load has completed. If an error occurs during an asynchronous image-loading operation, it will be caught and reported by the Error property of the AsyncCompletedEventArgs.method sets the
The following code example demonstrates how to use the PictureBox named pictureBox1 and a Button named startLoadButton. Make sure that the Click event for the button is associated with the startLoadButton_Click method in this example. You must change the image file path to a path that is valid on your system.method. To run this example, paste the following code into a Windows Form that contains a
Available since 2.0