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
'Declaração
<BrowsableAttribute(True)> _
Public Property BackColor As Color
Get
Set
[BrowsableAttribute(true)]
public Color BackColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color BackColor {
Color get ();
void set (Color value);
}
[<BrowsableAttribute(true)>]
member BackColor : Color with get, set
function get BackColor () : Color
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() 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)