- 关 键 词:
- windows
这个问题来自社区提问,代码保留一份用来以后回答
| using System; using System.ComponentModel; using System.Windows.Forms; namespace WindowsApplication4 ...{ /**//// <summary> /// gui 类 /// </summary> public partial class Form1 : Form ...{ public Form1() ...{ InitializeComponent(); } private void button1_Click(object sender, EventArgs e) ...{ //用子线程工作 new System.Threading.Thread(new System.Threading.ThreadStart(StartDownload)).Start(); } //开始下载 public void StartDownload() ...{ Downloader downloader = new Downloader(); downloader.onDownLoadProgress += new Downloader.dDownloadProgress(downloader_onDownLoadProgress); downloader.Start(); } //同步更新ui void downloader_onDownLoadProgress(long total, long current) ...{ if (this.InvokeRequired) ...{ this.Invoke(new Downloader.dDownloadProgress(downloader_onDownLoadProgress), new object[] ...{ total, current }); } else ...{ this.progressBar1.Maximum = (int)total; this.progressBar1.Value = (int)current; } } } /**//// <summary> |
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- 数据结构(C#)_排序算法(冒泡排序) (44次浏览)
- C#基础概念二十五问 (34次浏览)
- C#多线程学习—生产者和消费者 (33次浏览)
- 在C#.net中操作XML实例 (28次浏览)
- 截取字符串方法总结 (24次浏览)
- C#WIN窗体读取EXCEL存入SQL数据库 (24次浏览)
- C#与数据结构 (24次浏览)
- C#创建简单的验证码 (22次浏览)
- C#正则表达式整理备忘 (21次浏览)
- 用C#生成不重复的随机数 (21次浏览)



