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:
© 2014 Microsoft