基本信息
源码名称:c# winform 进度条入门级示例源码
源码大小:0.07M
文件格式:.zip
开发语言:C#
更新时间:2018-11-07
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

using System;
using System.Threading;
using System.Windows.Forms;
using System.Drawing;
namespace DemoForThreadTemplate
{

    public partial class ThreadDemo : Form
    {
        #region MyRegion
        public ThreadDemo()
        {
            InitializeComponent();
        }
        private void ThreadDemo_Load(object sender, EventArgs e)
        {

        }
        #endregion

        ThreadTemplate ttp= new ThreadTemplate();

        #region 滚动条进度事件
        ProBar pb;
        private delegate bool delegateForProgressBar(int i);
        private delegateForProgressBar dfp;

        private void ShowPB()
        {
            pb = new ProBar();
            dfp = new delegateForProgressBar(pb.IsShowProgressBar);
            pb.StartPosition = FormStartPosition.CenterParent;
            pb.Location = new Point(this.Location.X, this.Location.Y);
            pb.ShowDialog();
            

        }

        private void ThreadFun()
        {
            object obj = null;
            bool isBool = true;
            while (isBool)
            {
                Thread.Sleep(100);
                obj = this.Invoke(this.dfp, new object[] { 2 });
                isBool = (bool)obj;

            }
        }
        #endregion

        private void button1_Click(object sender, EventArgs e)
        {
            this.BeginInvoke(new MethodInvoker(ShowPB));

            Thread th = new Thread(new ThreadStart(ThreadFun));
            th.Start();

            ttp.tb = this.textBox1;
            ttp.Start();

        }
        private void button2_Click(object sender, EventArgs e)
        {
            ttp.Suspend();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ttp.Reset();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            ttp.Stop();
        }

        private void ThreadDemo_FormClosing(object sender, FormClosingEventArgs e)
        {
            ttp.Dispose();
        }


    }
}