Source Code : Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace toolStrip_Progress_Bar
{
public partial class Form1 : Form
{
Timer Time = new Timer();
public Form1()
{
InitializeComponent();
this.label1.Text = "0 %";
Time.Interval = 100;
Time.Enabled = false;
Time.Tick+=new EventHandler(Time_Tick);
}
private void button1_Click(object sender, EventArgs e)
{
Time.Enabled = true;
button1.Enabled = false;
toolStripProgressBar1.Value = toolStripProgressBar1.Minimum;
}
private void Time_Tick(object sender, EventArgs e)
{
toolStripProgressBar1.PerformStep();
label1.Text = toolStripProgressBar1.Value.ToString();
label1.Text += " %";
if (toolStripProgressBar1.Value == toolStripProgressBar1.Maximum)
{
label1.Text += " Complete Progress !";
Time.Enabled = false;
button1.Enabled = true;
}
}
}
}
Source Code : Form1.Designer.cs
namespace toolStrip_Progress_Bar
{
partial class Form1
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripProgressBar1});
this.statusStrip1.Location = new System.Drawing.Point(0, 132);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(268, 22);
this.statusStrip1.TabIndex = 0;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripProgressBar1
//
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
this.toolStripProgressBar1.Size = new System.Drawing.Size(250, 16);
this.toolStripProgressBar1.Step = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(60, 20);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(139, 44);
this.button1.TabIndex = 1;
this.button1.Text = "Start Progress";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(76, 101);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 13);
this.label1.TabIndex = 2;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(268, 154);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.statusStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "toolStrip Progress Bar";
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
}
}
Download :
exe
http://sites.google.com/site/ogremyfiles/toolStripProgressBar_EXE.rar
Source Code
http://sites.google.com/site/ogremyfiles/toolStripProgressBar_SourceCode.rar