Category / Section
How to display custom text in the WinForms ProgressBarAdv?
1 min read
Display the custom text
You can display the custom text in the ProgressBarAdv to indicate the status of the task instead of the percentage or value complete. The steps to achieve this are as follows.
- Set the ProgressBarAdv’s TextStyle to Custom.
- Handle the ProgressBarAdv's ValueChanged event, and set e.Text = "your desired text" and e.Handled = True.
The following code example demonstrates the same.
C#
//Raises the value changed event. this.progressBarAdv1.ValueChanged += new Syncfusion.Windows.Forms.Tools.ProgressBarValueChangedEventHandler(progressBarAdv1_ValueChanged); //Specifies the ProgressBarAdv text value. void progressBarAdv1_ValueChanged(object sender, Syncfusion.Windows.Forms.Tools.ProgressBarValueChangedEventArgs e) { e.Text = "ProgressBarvalue is changing"; e.Handled = true; }
VB
'Raises the value changed event. AddHandler progressBarAdv1.ValueChanged, AddressOf progressBarAdv1_ValueChanged 'Specifies the ProgressBarAdv text value. Private Sub progressBarAdv1_ValueChanged(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.ProgressBarValueChangedEventArgs) e.Text = "ProgressBarvalue is changing" e.Handled = True End Sub
Figure 1: ProgressBarAdv Text value specified as Custom