statusstrip & progressbar,timers in windows application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roheetbakshi
    New Member
    • Feb 2008
    • 3

    statusstrip & progressbar,timers in windows application

    i want to use statusstrip, Progressbar,tim ers in my windows application but for some reason i am not being able to use these so i need help ,


    can any one help me by giving the code for how to use these control in windows application
  • jjvainav
    New Member
    • Feb 2008
    • 25

    #2
    This should get you started

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsApplication2
    {
    	public class Form1 : Form
    	{
    		private System.Windows.Forms.StatusStrip statusStrip1;
    		private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
    		private System.Windows.Forms.Timer timer1;
    
    		public Form1()
    		{
    			InitializeComponent();
    			timer1.Start();
    		}
    
    		/// <summary>
    		/// Required method for Designer support - do not modify
    		/// the contents of this method with the code editor.
    		/// </summary>
    		private void InitializeComponent()
    		{
    			this.statusStrip1 = new System.Windows.Forms.StatusStrip();
    			this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
    			this.timer1 = new System.Windows.Forms.Timer();
    			this.statusStrip1.SuspendLayout();
    			this.SuspendLayout();
    			// 
    			// statusStrip1
    			// 
    			this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.toolStripProgressBar1});
    			this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
    			this.statusStrip1.Location = new System.Drawing.Point(0, 404);
    			this.statusStrip1.Name = "statusStrip1";
    			this.statusStrip1.Size = new System.Drawing.Size(508, 22);
    			this.statusStrip1.TabIndex = 0;
    			this.statusStrip1.Text = "statusStrip1";
    			// 
    			// toolStripProgressBar1
    			// 
    			this.toolStripProgressBar1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
    			this.toolStripProgressBar1.Name = "toolStripProgressBar1";
    			this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 16);
    			// 
    			// timer1
    			// 
    			this.timer1.Interval = 500;
    			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    			// 
    			// Form1
    			// 
    			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    			this.ClientSize = new System.Drawing.Size(508, 426);
    			this.Controls.Add(this.statusStrip1);
    			this.Name = "Form1";
    			this.Text = "Form1";
    			this.statusStrip1.ResumeLayout(false);
    			this.statusStrip1.PerformLayout();
    			this.ResumeLayout(false);
    			this.PerformLayout();
    
    		}
    
    		private void timer1_Tick(object sender, EventArgs e)
    		{
    			toolStripProgressBar1.PerformStep();
    			if(toolStripProgressBar1.Value == toolStripProgressBar1.Maximum)
    			{
    				timer1.Stop();
    			}
    		}
    	}
    }

    Comment

    Working...