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

  • 相关阅读:
    Codeforces Round #647 (Div. 2) A
    Acwing 1129. 热浪 解题报告
    二分 + 三分模板
    可持久化线段树(主席树)模板
    《架构之美》-----阅读笔记四
    《架构之美》-----阅读笔记三
    《架构之美》-----阅读笔记二
    《架构之美》-----阅读笔记一
    《软件需求》------阅读笔记三
    《软件需求》------阅读笔记二
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/11819747.html
Copyright © 2011-2022 走看看