zoukankan      html  css  js  c++  java
  • ProgressBarForm 进度条

    ProgressBarForm

        public partial class ProgressBarForm : Form
        {
            private Panel panel1 = new System.Windows.Forms.Panel();
            private ProgressBar progressBar1 = new System.Windows.Forms.ProgressBar();
    
            public ProgressBarForm()
            {
                InitializeComponent();
                InitializeComponent2();
            }
    
            public int LoadProgressBarRate(float currentNum, float totalCount)
            {
                float add = 100 / totalCount;
                var currentBar = (int)Math.Ceiling(add * currentNum);
                progressBar1.Value = currentBar >= 0 && currentBar <= 100 ? currentBar : 100;
                Application.DoEvents();
                return currentNum == totalCount ? 1 : 0;
            }
    
            private void InitializeComponent2()
            {
                this.panel1.SuspendLayout();
                this.SuspendLayout();
                // 
                // panel1
                // 
                this.panel1.Controls.Add(this.progressBar1);
                this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.panel1.Location = new System.Drawing.Point(0, 0);
                this.panel1.Name = "panel1";
                this.panel1.Size = new System.Drawing.Size(1000, 50);
                this.panel1.TabIndex = 0;
                // 
                // progressBar1
                // 
                this.progressBar1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.progressBar1.Location = new System.Drawing.Point(0, 0);
                this.progressBar1.Name = "progressBar1";
                this.progressBar1.Size = new System.Drawing.Size(1000, 50);
                this.progressBar1.TabIndex = 0;
                // 
                // ProgressBarForm
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(1000, 50);
                this.Controls.Add(this.panel1);
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.Name = "ProgressBarForm";
                this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                this.Text = "正在传输";
                this.panel1.ResumeLayout(false);
                this.ResumeLayout(false);
            }
        }

  • 相关阅读:
    luogu1197 [JSOI2008]星球大战
    luogu2085 最小函数值
    Vijos 1144 小胖守皇宫 【树形DP】
    洛谷 P1941 飞扬的小鸟 【DP+众多特判】
    codevs 1516 平均分数 【数学推理+求逆序对】
    tyvj 1936 太空战队 【强连通分量】
    USACO 2.4 Overfencing 【种子染色法+递推】
    code[vs] 2488 绿豆蛙的归宿【反向拓扑+DP】
    USACO 2.3 Zero Sum 【搜索+字符串处理+模拟计算】
    USACO 2.3 Cow Pedigrees 【DP+前缀和优化】
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/11819747.html
Copyright © 2011-2022 走看看