System.Windows.Forms.PictureBox.LoadAsync C# (CSharp) Method

LoadAsync() public method

public LoadAsync ( string url ) : void
url string
return void
		public void LoadAsync (string url)
		{
			// If WaitOnLoad is true, do not do async
			if (wait_on_load) {
				Load (url);
				return;
			}

			if (string.IsNullOrEmpty (url))
				throw new InvalidOperationException ("ImageLocation not specified.");

			image_location = url;
			ChangeImage (InitialImage, true);
			
			if (ImageDownload.IsBusy)
				ImageDownload.CancelAsync ();

			Uri uri = null;
			try {
				uri = new Uri (url);
			} catch (UriFormatException) {
				uri = new Uri (Path.GetFullPath (url));
			}

			ImageDownload.DownloadProgressChanged += new DownloadProgressChangedEventHandler (ImageDownload_DownloadProgressChanged);
			ImageDownload.DownloadDataCompleted += new DownloadDataCompletedEventHandler (ImageDownload_DownloadDataCompleted);
			ImageDownload.DownloadDataAsync (uri);
		}

Same methods

PictureBox::LoadAsync ( ) : void

Usage Example

Example #1
0
 public void show_image()
 {
     if (Visible)
     {
         try
         {
             if (image_path_replace.Length > 0)
             {
                 pictureBox_frame.LoadAsync(
                     label_image_pathname.Text.Replace(
                         image_path_replace,
                         image_path_replace_with
                         )
                     );
             }
             else
             {
                 pictureBox_frame.LoadAsync(label_image_pathname.Text);
             }
             if (!pictureBox_frame.Visible)
             {
                 pictureBox_frame.Visible = true;
             }
         }
         catch
         {
             try
             {
                 pictureBox_frame.Visible = false;
             }
             catch { }
         }
     }
 }
All Usage Examples Of System.Windows.Forms.PictureBox::LoadAsync