How to manipulate the degree of transparency (alpha blending) in the 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.
Figure 4: Gradient panel is fully transparent with blue color in the vertical Gradient style.
Sample Links:
C#: GradientPanel_C#
VB: GradientPanel_VB