Dela 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

'Declaration
<BrowsableAttribute(True)> _
Public Property BackgroundImageLayout As ImageLayout
    Get
    Set
[BrowsableAttribute(true)]
public ImageLayout BackgroundImageLayout { get; set; }
[BrowsableAttribute(true)]
public:
property ImageLayout BackgroundImageLayout {
    ImageLayout get ();
    void set (ImageLayout value);
}
[<BrowsableAttribute(true)>]
member BackgroundImageLayout : ImageLayout with get, set
function get BackgroundImageLayout () : ImageLayout
function set BackgroundImageLayout (value : 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 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

See Also

Reference

SimpleShape Class

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)

How to: Add Background Images to Windows Forms