Share via


SimpleShape.BackgroundImageLayout Property

 

Gets or sets the background image layout as defined in the ImageLayout enumeration.

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

Syntax

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

Property Value

Type: System.Windows.Forms.ImageLayout

One of the values of ImageLayout (Center,None, Stretch, Tile, or Zoom). Tile is the default value.

Remarks

Use the BackgroundImageLayout property to specify the position and behavior of an image that you have added to a control. BackgroundImageLayout takes effect only if the BackgroundImage property is set.

You can increase performance for large images if you set BackgroundImageLayout to something other than Tile.

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