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

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - jueban's space

js - jueban's space - 博客园 确定删除 - jueban's space - 博客园 SQL语句大全 上海 招聘 asp.net jq 的程序员 上海 招聘 asp.net jq 程序员 sql2005 asp.net2.0安全性(1)--用户角色篇(类) 常用编码工具类,支持base64,md5,des,crc32 reg 新城管如何变老城管 xss tt 可拖动,ModalPopup 新封装的仿kijiji的城市菜单 用ajax.net封装的不间断marquee行为 http://shanghai.myol.cn/ favicon.ico图标在线制作+ico下载 验证码 转贴 lightbox
进度条
jueban's space · 2008-05-22 · via 博客园 - jueban's space

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;namespace WindowsFormsApplication2
{
    
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;
            }
        }

    }

public class Downloader
    {
        
//委托
        public delegate void dDownloadProgress(long total,long current);
        
//事件
        public event dDownloadProgress onDownLoadProgress;
        
//开始模拟工作
        public void Start()
        {
            
for (int i = 0; i < 100; i++)
            {
                
if (onDownLoadProgress != null)
                    onDownLoadProgress(
100, i);
                System.Threading.Thread.Sleep(
100);
            }
            MessageBox.Show(
"ok");
        }
    }

}