Compartilhar via


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)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property BackStyle As BackStyle
[BrowsableAttribute(true)]
public BackStyle BackStyle { get; set; }
[BrowsableAttribute(true)]
public:
property BackStyle BackStyle {
    BackStyle get ();
    void set (BackStyle value);
}
[<BrowsableAttribute(true)>]
member BackStyle : BackStyle with get, set
function get BackStyle () : BackStyle 
function set BackStyle (value : BackStyle)

Property Value

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

Remarks

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.

Examples

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 Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Change between transparent and opaque. 
    If OvalShape1.BackStyle = PowerPacks.BackStyle.Transparent Then
        OvalShape1.BackStyle = PowerPacks.BackStyle.Opaque
        OvalShape1.BackColor = Color.LimeGreen
    Else
        OvalShape1.BackStyle = PowerPacks.BackStyle.Transparent
    End If 
End Sub
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;
    }
}

.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)