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); }
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论