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)

[BrowsableAttribute(true)]
public ImageLayout BackgroundImageLayout { get; set; }

Property Value

Type: System.Windows.Forms.ImageLayout

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

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.

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
Show: