Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SimpleShape.BackStyle Property

Gets or sets the transparency of the shape.

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

[BrowsableAttribute(true)]
public BackStyle BackStyle { get; set; }

Property Value

Type: Microsoft.VisualBasic.PowerPacks.BackStyle
One of the values of BackStyle (Opaque or Transparent). The default is Transparent.

When the BackStyle property is set to Transparent (the default), the BackColor property has no effect.

Setting the BackgroundImage or FillStyle property overrides the setting of BackStyle.

The following example shows how to use the BackStyle property to switch back and forth between an opaque and transparent shape. This example requires that you have an OvalShape control named OvalShape1 on a form.

private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Change between transparent and opaque. 
    if (ovalShape1.BackStyle == BackStyle.Transparent)
    {
        ovalShape1.BackStyle = BackStyle.Opaque;
        ovalShape1.BackColor = Color.LimeGreen;
    }
    else
    {
        ovalShape1.BackStyle = BackStyle.Transparent;
    }
}

Show:
© 2015 Microsoft