ProcessBar

private void CopyWithProgress(int status)
        
{
            
// Display the ProgressBar control.
            
//pBar1.Visible = true;
            
// Set Minimum to 1 to represent the first file being copied.
            pBar1.Minimum = 1;
            
// Set Maximum to the total number of files to copy.
            pBar1.Maximum = status;
            
// Set the initial value of the ProgressBar.
            pBar1.Value = 50000;
            
// Set the Step property to a value of 1 to represent each file being copied.
            pBar1.Step = 1;

            
// Loop through all files to copy.
            
//int x = 300;
            for (int x=pBar1.Value; x <= status; x++)
            
{
                
// Copy the file and increment the ProgressBar if successful.
                if (x == status)
                
{
                    
// Perform the increment on the ProgressBar.
                    pBar1.PerformStep();
                }

                pBar1.Value 
= x;
                
this.pBar1.Refresh();
               
            }

            MessageBox.Show(
"下载完毕!");
        }

posted @ 2007-04-25 21:15  yongwnet  阅读(514)  评论(0编辑  收藏  举报