SimpleShape.BackColor Property

Gets or sets the background color for the shape.

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

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property BackColor As Color
'Usage
Dim instance As SimpleShape 
Dim value As Color 

value = instance.BackColor

instance.BackColor = value
[BrowsableAttribute(true)]
public Color BackColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color BackColor {
    Color get ();
    void set (Color value);
}
public function get BackColor () : Color 
public function set BackColor (value : Color)

Property Value

Type: System.Drawing.Color
A Color that represents the background color of the shape. The default is the value of the DefaultBackColor property.

Remarks

The BackColor property has no effect when the BackStyle property is set to Transparent or when FillStyle is set to Solid.

Notes to Inheritors:

When overriding the BackColor property in a derived class, use the BackColor property of the base class to extend the base implementation. Otherwise, you must provide all the implementation. You are not required to override both the get and set accessors of the BackColor property; you can override only one if you have to.

Examples

The following example shows how to use the BackColor property to switch the color of a shape back and forth between two colors. This example requires that you have an OvalShape control named OvalShape1 on a form.

Private Sub OvalShape1_Click(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles OvalShape1.Click
    ' Set the BackStyle and FillStyle.
    OvalShape1.BackStyle = PowerPacks.BackStyle.Opaque
    OvalShape1.FillStyle = PowerPacks.FillStyle.Transparent
    ' Change the color between red and blue. 
    If OvalShape1.BackColor = Color.Red Then
        OvalShape1.BackColor = Color.Blue
    Else
        OvalShape1.BackColor = Color.Red
    End If 
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Set the BackStyle and FillStyle.
    ovalShape1.BackStyle = BackStyle.Opaque;
    ovalShape1.FillStyle = FillStyle.Transparent;
    // Change the color between red and blue. 
    if (ovalShape1.BackColor == Color.Red)
    {
        ovalShape1.BackColor = Color.Blue;
    }
    else
    {
        ovalShape1.BackColor = Color.Red;
    }
}

.NET Framework Security

See Also

Reference

SimpleShape Class

SimpleShape Members

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)