)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the appearance of the WaitingGradient style in the WinForms ProgressBarAdv?

Platform: WinForms |
Control: ProgressBarAdv |
Published Date: September 1, 2015 |
Last Revised Date: January 7, 2020

Customize the appearance of ProgressBarAdv

You can customize the appearance of the ProgressBarAdv when using the ProgressStyle as ProgressBarStyles.WaitingGradient. The customized ProgressBarStyle can be achieved by handling the event, DrawWaitingCustomRender, and enabling the property, CustomWaitingRender in the ProgressBarAdv.

C#

//Specifies the ProgressBar style.
this.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.WaitingGradient;
//Customizes the waiting to render.
this.progressBarAdv1.CustomWaitingRender = true;
//Enables the waiting gradient.
this.progressBarAdv1.WaitingGradientEnabled = true;
//Customize the ProgressBar appearance.
this.progressBarAdv1.DrawWaitingCustomRender += new Syncfusion.Windows.Forms.Tools.ProgressBarAdvDrawEventHandler(progressBarAdv1_DrawWaitingCustomRender);
//Handles this event to draw a custom waiting to render.
void progressBarAdv1_DrawWaitingCustomRender(object sender, Syncfusion.Windows.Forms.Tools.ProgressBarAdvDrawEventArgs e)
{
    Region region = new System.Drawing.Region();
    region.MakeEmpty();
    region.Union(e.Rectangle);
    LinearGradientBrush brush = new LinearGradientBrush( new Point(e.Rectangle.X, 0),
            new Point(e.Rectangle.X + e.Rectangle.Width, 0), Color.Blue, Color.Red);
    e.Graphics.FillRegion(brush, region);
    e.Handled = true;
}

VB

' Specifies the ProgressBar style
Me.progressBarAdv1.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.WaitingGradient
'Customizes the waiting to render.
Me.progressBarAdv1.CustomWaitingRender = True
'Enables the waiting gradient.
Me.progressBarAdv1.WaitingGradientEnabled = True
'Customizes the ProgressBar appearance.
AddHandler progressBarAdv1.DrawWaitingCustomRender, AddressOf progressBarAdv1_DrawWaitingCustomRender
'Handles this event to draw a custom waiting to render.
Private Sub progressBarAdv1_DrawWaitingCustomRender(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.ProgressBarAdvDrawEventArgs)
    Dim region As Region = New System.Drawing.Region()
    region.MakeEmpty()
    region.Union(e.Rectangle)
    Dim brush As New LinearGradientBrush(New Point(e.Rectangle.X, 0), New Point(e.Rectangle.X + e.Rectangle.Width, 0), Color.Blue, Color.Red)
    e.Graphics.FillRegion(brush, region)
    e.Handled = True
End Sub

 

Note:

The property named “WaitingGradientEnabled” helps to enable the waiting gradient style in the ProgressBarAdv.

 

Progress style specified as Waiting gradient

Figure 1: ProgressStyle specified as WaitingGradient

ProgressBar with custom draw in Waiting gradient style

Figure 2: ProgressBar with custom draw in WaitingGradient style

Samples:

C#: ProgressBarAdv_CustomDraw_C#

VB: ProgressBarAdv_CustomDraw_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon