Displays asynchronous downloaded pictures in winform
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { ////Use WebClient to download pictures using (WebClient wc = new WebClient()) { /////WebClient response event binding += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted); //// Start asynchronous download, please specify the image URL path according to the actual situation //// At the same time, the line number of the current line of DataGridView is passed, which is used to specify the CELL of the picture display (new Uri(this.[].Cells[1].()), ); } } void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { //// If there is no error in the download process and it is not cancelled in the middle if ( == null && !) { ////// Display the image in the corresponding specified cell, which is the incoming //// It's the download result this.[(int)].Cells["src"].Value = ; // this.[(int)].Cells["test"].Value = GetImage("1"); } }
The above are some code snippets that display asynchronous downloading pictures. I hope you can give you a reference and I hope you can support me more.
Related Articles
A detailed explanation of the comparison example of C# implementation type
This article mainly introduces relevant materials on the comparison of C# implementation types. The article introduces the example code in detail, which has certain reference learning value for everyone to learn or use C#. If you need it, let’s learn together.2019-04-04Generate file names using GetInvalidFileNameCharts
This article mainly introduces a very practical function(), which can easily generate a valid file name2014-01-01Introduction to C# file path Path class
This article introduces the file path Path class in C#, and the article introduces it in detail through sample code. It has certain reference value for everyone's study or work. Friends who need it can refer to it.2022-05-05.NET C# uses ZXing to generate and identify QR codes/barcodes
ZXing is an open source, 1D/2D barcode image processing library implemented in Java in multiple formats, which contains ports connected to other languages. This article mainly introduces to you the method of .NET C# using ZXing to generate and identify QR codes/barcodes. The article provides detailed example codes, and friends in need can refer to them.2016-12-12C# How to use XML to serialize the operation menu
This article mainly introduces the method of using XML serialization to operate menus in C#. It is based on the previous article to improve the recursive reading of XML menu data. It has certain reference value. Friends who need it can refer to it.2014-12-12C# implements a method to capture external variables in anonymous methods
This article mainly introduces the method of C# to capture external variables in anonymous methods. This article directly gives code examples and then analyzes some knowledge points in the code. Friends who need it can refer to it.2015-03-03Detailed explanation of how to implement stack using Object class in C#
This article mainly introduces the method of using the Object class to implement the stack in C#, and analyzes the principles of the stack in detail and the relevant techniques and precautions for using the Object class to implement the stack. Friends who need it can refer to it.2016-06-06Complete example of file upload and download tool class implemented by C# [automatically naming of upload files]
This article mainly introduces the file upload and download tool class implemented by C#. It analyzes the C# operation file upload and download functions in combination with the complete example form. It can also be automatically named for upload files to avoid duplication of file names in the server. Friends who need it can refer to it.2017-11-11Tutorial for getting started with char and string in C#
This article mainly introduces you to the introductory tutorial on the use of char and string in C#. The article introduces the example code and graphics in detail, which has a certain reference learning value for everyone to learn or use C#. If you need it, let’s learn together.2020-07-07C# implements a method of converting a thousandth string into a number
This article mainly introduces the method of converting a thousandth of string into a number in C#. It is very suitable for beginners to better understand the principles of C# strings. Friends who need it can refer to it.2014-08-08