C# WebClient download image within url and display the downloaded picture automatically in windows os

2022-10-09,,,,

static void webclientdownload()
        {
            string url = "http://p4.ssl.cdn.btime.com/t0167dce5a13c3da30d.jpg?size=5012x3094";
            webclient client = new webclient();
            client.downloaddatacompleted += clientdownloaddatacompleted; 
            client.downloaddataasync(new uri(url));

        }

        private static void clientdownloaddatacompleted(object sender, downloaddatacompletedeventargs e)
        {
            byte[] imgbytes = e.result;
            using(memorystream ms=new memorystream(imgbytes))
            {
                image img = image.fromstream(ms);
                img.save("lyf.jpg",imageformat.jpeg);                 
            }
            processstartinfo info = new processstartinfo();
            info.filename = "lyf.jpg";
            info.useshellexecute = true;
            info.verb = string.empty;
            process.start(info);
        }

 

《C# WebClient download image within url and display the downloaded picture automatically in windows os.doc》

下载本文的Word格式文档,以方便收藏与打印。