共用方式為


SimpleShape.FillColor Property

Gets or sets the color 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 FillColor As Color
    Get
    Set
[BrowsableAttribute(true)]
public Color FillColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color FillColor {
    Color get ();
    void set (Color value);
}
[<BrowsableAttribute(true)>]
member FillColor : Color with get, set
function get FillColor () : Color
function set FillColor (value : Color)

Property Value

Type: System.Drawing.Color
The Color that is used to fill the shape.

Remarks

The FillColor property has no effect when the FillStyle is set to Transparent. If both the BackColor and FillColor are set and FillStyle is set to Solid, FillColor overrides BackColor.

For all FillStyle enumerations except for Solid and Transparent, FillColor is used as the color for the pattern and BackColor is used as the background color.

Examples

The following example shows how to use the FillColor 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)