共用方式為


SimpleShape.FillGradientStyle Property

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

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

Syntax

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

Property Value

Type: Microsoft.VisualBasic.PowerPacks.FillGradientStyle
A FillGradientStyle enumeration that determines the type and direction of a gradient fill displayed on the shape.

Remarks

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

When the 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 the 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 FillGradientStyle 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)