Dela via


SimpleShape.FillGradientColor Property

Gets or sets the gradient color that is used to fill the shape.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property FillGradientColor As Color
    Get
    Set
[BrowsableAttribute(true)]
public Color FillGradientColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color FillGradientColor {
    Color get ();
    void set (Color value);
}
[<BrowsableAttribute(true)>]
member FillGradientColor : Color with get, set
function get FillGradientColor () : Color
function set FillGradientColor (value : Color)

Property Value

Type: System.Drawing.Color
The Color that is used for a gradient fill.

Remarks

If the FillStyle property is set to any value other than Solid, the gradient effect will not be displayed.

When FillGradientStyle is set to None, this property has no effect.

When FillGradientStyle is set to Central, the color at the center of the shape will be determined by FillGradientColor. This color will gradually blend into the FillColor at the outer edges.

When FillGradientStyle is set to Horizontal or ForwardDiagonal, colors are blended from the FillColor on the left to the FillGradientColor on the right.

When FillGradientStyle is set to BackwardDiagonal, colors are blended from the FillGradientColor on the left to the FillColor on the right.

When FillGradientStyle is set to Vertical, colors are blended from the FillColor on the top to the FillGradientColor on the bottom.

Examples

The following example shows how to use the FillGradientColor property to change the appearance of a shape. This example requires that you have an OvalShape control named OvalShape1 on a form.

Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Set the fill style.
    OvalShape1.FillStyle = FillStyle.Solid
    ' Set the fill color.
    OvalShape1.FillColor = Color.Red
    ' Set the gradient style.
    OvalShape1.FillGradientStyle = FillGradientStyle.Central
    ' Set the gradient color.
    OvalShape1.FillGradientColor = Color.Purple
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Set the fill style.
    ovalShape1.FillStyle = FillStyle.Solid;
    // Set the fill color.
    ovalShape1.FillColor = Color.Red;
    // Set the gradient style.
    ovalShape1.FillGradientStyle = FillGradientStyle.Central;
    // Set the gradient color.
    ovalShape1.FillGradientColor = Color.Purple;
}

.NET Framework Security

See Also

Reference

SimpleShape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the Line and Shape Controls (Visual Studio)

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)