We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How can I change the ProgressStyle dynamically?

 

You can handle the ValueChanged event and change the ProgressStyle depending on the value.

C#

   private void timer1_Tick(object sender, System.EventArgs e)

  {

   if (this.progressBarAdv1.Value<100)

    this.progressBarAdv1.Value++;

   else

    this.progressBarAdv1.Value = 0;

  }

       private void progressBarAdv1_ValueChanged(object sender, Syncfusion.Windows.Forms.Tools.ProgressBarValueChangedEventArgs e)

  {

   if(this.progressBarAdv1.Value >0 && this.progressBarAdv1.Value <15)

   {

    this.progressBarAdv1.ProgressStyle =Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Tube ;

        }

if(this.progressBarAdv1.Value >15 && this.progressBarAdv1.Value <30)

   {

this.progressBarAdv1.ProgressStyle =Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Gradient ;

   }

   else if(this.progressBarAdv1.Value >30 && this.progressBarAdv1.Value <50)

   {

    this.progressBarAdv1.ProgressStyle =Syncfusion.Windows.Forms.Tools.ProgressBarStyles.MultipleGradient;

    }

   else if(this.progressBarAdv1.Value >50)

   {

this.progressBarAdv1.ProgressStyle =Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Image ;

        }

  }

 

 

VB

 Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer1.Tick

        If Me.progressBarAdv1.Value < 100 Then

Me.progressBarAdv1.Value += 1

        Else

Me.progressBarAdv1.Value = 0

        End If

    End Sub

         Private Sub progressBarAdv1_ValueChanged(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.ProgressBarValueChangedEventArgs) Handles progressBarAdv1.ValueChanged

        If Me.progressBarAdv1.Value > 0 AndAlso Me.progressBarAdv1.Value < 15 Then

Me.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Tube

         End If

          If Me.progressBarAdv1.Value > 15 AndAlso Me.progressBarAdv1.Value < 30 Then

Me.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Gradient

         ElseIf Me.progressBarAdv1.Value > 30 AndAlso Me.progressBarAdv1.Value < 50 Then

Me.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.MultipleGradient

         ElseIf Me.progressBarAdv1.Value > 50 Then

Me.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Image

         End If

    End Sub

End Class

Article ID: Published Date: Last Revised Date: Platform: Control:
1478 04/30/2011 07/10/2014 Windows Forms ProgressBarAdv
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.