2
Answers

ProgressBar

keenweng2001

keenweng2001

19y
2.5k
1
I am facing some problem in using a color progress bar. Below is my code. The progress bar only start perform step after the tree view is display. What i need is while the program are searching in the directory the progress bar start showing the progress. // progressbar property this.colorProgressBar1.BarColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(128))); this.colorProgressBar1.BorderColor = System.Drawing.Color.Black; this.colorProgressBar1.FillStyle = ColorProgressBar.ColorProgressBar.FillStyles.Dashed; this.colorProgressBar1.Location = new System.Drawing.Point(448, 184); this.colorProgressBar1.Maximum = 100; this.colorProgressBar1.Minimum = 0; this.colorProgressBar1.Name = "colorProgressBar1"; this.colorProgressBar1.Size = new System.Drawing.Size(150, 15); this.colorProgressBar1.Step = 10; this.colorProgressBar1.TabIndex = 28; this.colorProgressBar1.Value = 0; // timer1 this.timer1.Enabled = false; this.timer1.Tick += new System.EventHandler(this.TimerEventProcessor); private void TimerEventProcessor(Object myObject,EventArgs myEventArg) { colorProgressBar1.PerformStep(); } private void Btn1_Click(object sender, System.EventArgs e) { timer1.Enabled = true; statusBar1.Text = " Detecting Network Terminal...... " ; private System.Windows.Forms.TreeView Terminal_List; DirectoryEntry Parent = new DirectoryEntry("WinNT:"); TreeNode Root = new TreeNode("Microsoft Windows Network",0,0); Terminal_List.Nodes.Add (Root); foreach (DirectoryEntry child in Parent.Children) { switch (child.SchemaClassName) { case "Domain": TreeNode Domain = new TreeNode(child.Name,2,2); Root.Nodes.Add (Domain); break; }} }
Answers (2)