Share via


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)

Syntax

[BrowsableAttribute(true)]
public Image BackgroundImage { get; set; }
public:
[BrowsableAttribute(true)]
property Image^ BackgroundImage {
    Image^ get();
    void set(Image^ value);
}
[<BrowsableAttribute(true)>]
member BackgroundImage : Image with get, set
<BrowsableAttribute(True)>
Public Property BackgroundImage As Image

Property Value

Type: System.Drawing.Image

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

Remarks

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

Note

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.

Examples

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;
}
Private Sub Form1_Load() Handles MyBase.Load
    ' Assign an image resource.
    OvalShape1.BackgroundImage = My.Resources.Image1
    ' Resize the image to fit the oval.
    OvalShape1.BackgroundImageLayout = ImageLayout.Stretch
End Sub

See Also

SimpleShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)

7a509ba2-055c-4ae6-b88a-54625c6d9aff

Return to top