做进度条 根据自己的数据显示进度

做了很多种方法 

1:

线程 thread的方法

2:

backGroundWorker的方法

3:

自定义线程类

4:

做一个进度条的窗体  通过自定义设置做(最方便快捷)

public partial class waitingProcessbar : Form
    {
        public waitingProcessbar()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 设定百分比
        /// </summary>
        private int percent;
        /// <summary>
        /// 字符显示百分比
        /// </summary>
        private string labelShow;
        public int Percent
        {
            get { return percent; }
            set {
                this.percent = value;
                if (this.percent > 100)
                {
                    this.Close();
                }
                this.progressBar1.Value = percent;
            }
            
        }
        public string LabelShow
        {
            get { return this.labelShow; }
            set 
            {
                this.labelShow = value;
                this.label1.Text = labelShow.ToString();
            }
        }
        public void ShowProcess(int num,string str)
        {
            this.Show();
            this.Percent = num;
            this.LabelShow = str;
            progressBar1.Invalidate();
            label1.Refresh();
        }
    }
原文地址:https://www.cnblogs.com/zhayunjia/p/4648460.html