SimpleShape.BackgroundImage Property


Gets or sets the image displayed in the shape.

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

public Image BackgroundImage { get; set; }

Property Value

Type: System.Drawing.Image

An Image that represents the image to display in the background of the shape.

Use the BackgroundImage property to put a graphic image onto a shape.


Setting the BackgroundImage property overrides any settings for the BackColor, BackStyle, FillColor, FillGradientColor, FillGradientStyle, and FillStyle properties.

Notes to Inheritors:

When overriding the BackgroundImage property in a derived class, use the BackgroundImage 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 BackgroundImage property; you can override only one if you have to.

The following example shows how to use the BackgroundImage and BackgroundImageLayout properties to display an image on a shape. This example requires that you have an OvalShape control named OvalShape1 on a form and that your project contains an image resource named Image1.

private void form1_Load(System.Object sender, System.EventArgs e)
    // Assign an image resource.
    ovalShape1.BackgroundImage = SimpleShapeBackGroundImageCS.Properties.Resources.Image1;
    // Resize the image to fit the oval.
    ovalShape1.BackgroundImageLayout = ImageLayout.Stretch;
Return to top