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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to manipulate the degree of transparency (alpha blending) in the Gradient Panel?

Platform: WinForms |
Control: GradientPanel |
Published Date: April 30, 2011 |
Last Revised Date: May 24, 2019

You can change the alpha blending. The alpha parameter of the BrushInfo controls the gradient brush transitions between the start and the end colors.

Refer to the following code examples.

C#

BrushInfo brush = new BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.Color.Transparent, System.Drawing.Color.Blue);
//Sets the gradient background color
this.gradientPanel1.BackgroundColor = new BrushInfo(this.trackBarEx1.Value, brush);

 

VB

Dim brush As New BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.Color.Transparent, System.Drawing.Color.Blue)
'Sets the gradient background color
Me.gradientPanel1.BackgroundColor = New BrushInfo(Me.trackBarEx1.Value, brush)

 

Note:

By using the BrushInfo class, you can specify the Gradient style and other style based on your requirement. For example, the Gradient style can be specified as Vertical, Horizontal, PathEllipse, PathRectangle, ForwardDiagonal and BackwardDiagonal.

 

Default back color of the gradient panel

Figure 1: Default back color of the Gradient panel.

Gradient panel is partially transparent with blue color in vertical gradient style

Figure 2:Gradient panel is partially transparent with blue color in the vertical Gradient style.

Gradient panel is halfly transparent with blue color in vertical gradient style

Figure 3: Gradient panel is 50 % transparent with blue color in the vertical Gradient style.

Gradient panel is fully transparent with blue color in vertical gradient style

Figure 4: Gradient panel is fully transparent with blue color in the vertical Gradient style.

 

Sample Links:

C#: GradientPanel_C#

VB: GradientPanel_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