Partager via


SimpleShape.BackgroundImageLayout, propriété

Obtient ou définit la disposition d'image d'arrière-plan définie dans l'énumération ImageLayout.

Espace de noms :  Microsoft.VisualBasic.PowerPacks
Assembly :  Microsoft.VisualBasic.PowerPacks.Vs (dans Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntaxe

'Déclaration
<BrowsableAttribute(True)> _
Public Property BackgroundImageLayout As ImageLayout
[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)

Valeur de propriété

Type : System.Windows.Forms.ImageLayout
Une des valeurs d'ImageLayout (Center, None, Stretch, Tile, ou Zoom). Tile est la valeur par défaut.

Notes

Utilisez la propriété d'BackgroundImageLayout pour spécifier la position et le comportement d'une image que vous avez ajoutée à un contrôle.BackgroundImageLayout prend effet uniquement si la propriété BackgroundImage est définie.

Vous pouvez améliorer les performances des images de grande taille en affectant à BackgroundImageLayout une valeur autre que Tile.

Exemples

L'exemple suivant montre comment utiliser les propriétés d'BackgroundImage et d'BackgroundImageLayout pour afficher une image sur une forme.Cet exemple requiert que vous avez un contrôle d'OvalShape nommé OvalShape1 sur un formulaire et que votre projet contient une ressource en image nommée 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;
}

Sécurité .NET Framework

Voir aussi

Référence

SimpleShape Classe

Microsoft.VisualBasic.PowerPacks, espace de noms

Autres ressources

Introduction aux contrôles Line et Shape (Visual Studio)

Comment : dessiner des lignes avec le contrôle LineShape (Visual Studio)

Comment : dessiner des formes avec les contrôles OvalShape et RectangleShape (Visual Studio)

Comment : ajouter des images d'arrière-plan à des Windows Forms