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
'Declaration
<BrowsableAttribute(True)> _
Public Property BackgroundImage As Image
[BrowsableAttribute(true)]
public Image BackgroundImage { get; set; }
[BrowsableAttribute(true)]
public:
property Image^ BackgroundImage {
Image^ get ();
void set (Image^ value);
}
[<BrowsableAttribute(true)>]
member BackgroundImage : Image with get, set
function get BackgroundImage () : Image
function set BackgroundImage (value : 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 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
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;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)