zoukankan      html  css  js  c++  java
  • 使用timer控件控制进度条

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace ECS.Simulate
    {
        public partial class FrmProgress : Form
        {
            public FrmProgress()
            {
                InitializeComponent();
                this.CenterToParent();
                progressBar1.Maximum = 1000;
                progressBar1.Step = 10;
                timer1.Enabled = true;
            }

            private void FrmProgress_Load(object sender, EventArgs e)
            {

            }

            private void timer1_Tick(object sender, EventArgs e)
            {
                if (this.progressBar1.Value == this.progressBar1.Maximum)
                {
                    this.progressBar1.Value = this.progressBar1.Minimum;
                }
                else
                {
                    if (StatusData.flag)
                    {
                        this.progressBar1.PerformStep();
                        this.Close();
                        this.Dispose();
                        GC.Collect();
                        StatusData.flag = false;
                    }
                    this.progressBar1.PerformStep();
                }
            }
        }

        public class StatusData
        {
            public static bool flag = false;
        }

    }

  • 相关阅读:
    理性即自由
    解决问题的思路是怎样的?
    联系的结构-深度思考
    思考力,才是真正的第一生产力-快思考、慢思考
    CentOS7在防火墙与端口上的操作
    linux如何查看nginx是否启动
    Git篇
    Git 常用命令总结
    siblings() 获得匹配集合中每个元素的同胞
    Mysql查看版本号的五种方式介绍
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/3231996.html
Copyright © 2011-2022 走看看