Articles in this section
Category / Section

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

1 min read

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

 

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