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;
        }

    }

  • 相关阅读:
    合并区间
    编程团体赛
    寻找数组的中间位置
    翻转链表2
    链表翻转
    CF1237H. Balanced Reversals
    arc108E
    agc028D
    CF1446D. Frequency Problem
    CF1439D. INOI Final Contests
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/3231996.html
Copyright © 2011-2022 走看看