If, after calling the PerformStep method, the Value property is greater than the value of the Maximum property, the Value property remains at the value of the Maximum property. The Value property specifies the current position of the ProgressBar. If you want to have more flexible control of the value of the progress bar, you can use the Increment method or set the value of the Value property directly.
When each file is copied, you can call the PerformStep method to increment the progress bar by the value of the Step property. For example, if you are copying a group of files, you might want to set the value of the Step property to 1 and the value of the Maximum property to the total number of files to copy. You can use the Step property to specify the amount that each completed task in an operation changes the value of the progress bar. The PerformStep method increments the value of the progress bar by the amount specified by the Step property. ' Perform the increment on the ProgressBar. If CopyFile(filenames(x - 1)) = True Then ' Copy the file and increment the ProgressBar if successful. ' Set the Step property to a value of 1 to represent each file being copied. ' Set the initial value of the ProgressBar. ' Set Maximum to the total number of files to copy. ' Set Minimum to 1 to represent the first file being copied. Private Sub CopyWithProgress(ByVal ParamArray filenames As String()) Private void CopyWithProgress(string filenames)įor (int x = 1 x <= filenames.Length x++)
Perform the increment on the ProgressBar. Copy the file and increment the ProgressBar if successful. Set the Step property to a value of 1 to represent each file being copied. Set the initial value of the ProgressBar. Set Maximum to the total number of files to copy. Set Minimum to 1 to represent the first file being copied.
#Devexpress progress bar code#
The code also requires that an array of strings containing the files to copy is created and passed to the CopyWithProgress method defined in the example, and that the method is called from another method or event in the Form. This example requires that you have a ProgressBar control created called pBar1 that is created within a Form, and that there is a method created called CopyFile (that returns a Boolean value indicating the file copy operation was completed successfully) that performs the file copy operation. The code also uses the Step property with the PerformStep method to increment the value of the ProgressBar as a file is copied. The example uses the Minimum and Maximum properties to specify a range for the ProgressBar that is equivalent to the number of files to copy.
If (e.ProgressPercentage >= 0 & e.ProgressPercentage <= 100 )ĭ = e.ProgressPercentage īackground task execution completion event private void bgWorker_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e)ĭ following code example uses a ProgressBar control to display the progress of a file copy operation. MainRecords = > (fs) īackground task progress change event private void bgWorker_ProgressChanged( object sender, ProgressChangedEventArgs e) Using (System.IO.Stream fs = new System.IO.FileStream(mainRecordDataFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)) If (System.IO.File.Exists(mainRecordDataFile)) = String.Format( " ", , Global.MAIN_EXT) Private FrmProgressBar( bool isShowTitle) / public static FrmProgressBar Instance Private static FrmProgressBar _instance = null Private static string _lockFlag = " FrmProgressBarLock "
Then open its code page and edit its code as public partial class FrmProgressBar : SplashScreen Then drag and drop a label and MarqueeProgressBarControl control Realization Design progress bar formĬreate a new form FrmProgressBar, open the design page, and open the devoxpress toolbox.
#Devexpress progress bar free#
Get programming related ebooks, tutorials and free downloads. To create a new form, add a progress bar control to the form, and then report the loading progress to the Implementation of pop-up progress bar in Winform