Articles in this section
Category / Section

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

2 mins read

Customize the appearance of ProgressBarAdv

You can customize the appearance of the WinForms 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

Conclusion

I hope you enjoyed learning about how to customize the appearance of the WaitingGradient style in the WinForms ProgressBarAdv.

You can refer to our WinForms ProgressBar’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms ProgressBar documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms ProgressBar and other WinForms components.

 

If you have any queries or require clarifications, please let us know in the comment section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied