SimpleShape.BackgroundImageLayout, propriété

Mise à jour : novembre 2007

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

<BrowsableAttribute(True)> _
Public Property BackgroundImageLayout As ImageLayout

Dim instance As SimpleShape
Dim value As ImageLayout

value = instance.BackgroundImageLayout

instance.BackgroundImageLayout = value
[BrowsableAttribute(true)]
public ImageLayout BackgroundImageLayout { get; set; }
[BrowsableAttribute(true)]
public:
property ImageLayout BackgroundImageLayout {
    ImageLayout get ();
    void set (ImageLayout value);
}
public function get BackgroundImageLayout () : ImageLayout
public function set BackgroundImageLayout (value : ImageLayout)

Valeur de propriété

Type : System.Windows.Forms.ImageLayout

L'une des valeurs de ImageLayout (Center, None, Stretch, Tile ou Zoom). Tile est la valeur par défaut.

Notes

Utilisez la propriété BackgroundImageLayout pour spécifier la position et le comportement d'une image 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 BackgroundImage et BackgroundImageLayout pour afficher une image sur une forme. Cet exemple suppose qu'il existe un contrôle OvalShape nommé OvalShape1 sur un formulaire et que votre projet contient une ressource d'image nommée Image1.

Private Sub Form1_Load(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) 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;
}

Autorisations

Voir aussi

Référence

SimpleShape, classe

Membres SimpleShape

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