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 = / totalCount;
var currentBar = (int)Math.Ceiling(add \* currentNum);
progressBar1.Value = currentBar >= && currentBar <= ? currentBar : ;
Application.DoEvents();
return currentNum == totalCount ? : ;
}
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(, );
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(, );
this.panel1.TabIndex = ;
//
// progressBar1
//
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressBar1.Location = new System.Drawing.Point(, );
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(, );
this.progressBar1.TabIndex = ;
//
// ProgressBarForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
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);
}
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章