惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
Y
Y Combinator Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
D
Docker
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
B
Blog
Vercel News
Vercel News
Recent Announcements
Recent Announcements
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
宝玉的分享
宝玉的分享

博客园 - yulei

几个css技巧 HttpWebRequest 发送 POST实现自动用户登录 - yulei jquery selector 基础 - yulei asp.net ajax实现:Jquery+Json - yulei - 博客园 smtp协议 发送带附件的邮件 控制滚动条 (转)防数据库批量注入JS 转载 JS获取CSS属性值 - yulei - 博客园 HttpCompress相关问题解决方法 - yulei - 博客园 C#发送Email邮件方法总结 数据导出到excel文件给客户端下载的几种方法(转) ndoc2007,生成注释文档,支持泛型,2.0,中文注解,部分汉化 IE和Firefox浏览器CSS网页布局不同点 - yulei - 博客园 通用获得网页的实际大小的javascript函数 仿DVBBS下拉菜单效果 asp.net下URL网址重写成.html格式、RSS、OPML的知识总结 导出excel 使用AD724的RGB→NTSC/PAL制信号转换电路 AV-RF转换器的制作
webClient下载进度条
yulei · 2009-03-08 · via 博客园 - yulei
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;namespace DownlaodFile
{
public partial class Form1 : Form
{
System.Net.WebClient c ;
public Form1()
{
InitializeComponent();
c
= new System.Net.WebClient();
c.DownloadProgressChanged
+= new System.Net.DownloadProgressChangedEventHandler(c_DownloadProgressChanged);
c.DownloadFileCompleted
+= new AsyncCompletedEventHandler(c_DownloadFileCompleted);
c.Proxy
=WebRequest.DefaultWebProxy;
c.Proxy.Credentials
= new NetworkCredential("admin", "admin_password", "domain");
}
void c_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show(
"ok");
}
private void btnDownload_Click(object sender, EventArgs e)
{
c.DownloadFileAsync(
new Uri(txtUrl.Text), @"d:"t.dat");
}
void c_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
{
progressBar1.Value
= e.ProgressPercentage;
}
private void btnQuit_Click(object sender, EventArgs e)
{
if (c!=null)
{
c.CancelAsync();
}
Close();
}
}
}