How to manipulate the degree of transparency in WinForms Gradient Panel?
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)
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.
Figure 1: Default back color of the Gradient panel.
Figure 2:Gradient panel is partially transparent with blue color in the vertical Gradient style.
Figure 3: Gradient panel is 50 % transparent with blue color in the vertical Gradient style.
Caption
Figure 4: Gradient panel is fully transparent with blue color in the vertical Gradient style.
Conclusion
I hope you enjoyed learning about how to manipulate the degree of transparency in WinForms Gradient Panel.
You can refer to our WinForms Gradient Panel feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!