Proprietà SimpleShape.BackgroundImage

Aggiornamento: novembre 2007

Ottiene o imposta l'immagine visualizzata nella forma.

Spazio dei nomi:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintassi

<BrowsableAttribute(True)> _
Public Property BackgroundImage As Image

Dim instance As SimpleShape
Dim value As Image

value = instance.BackgroundImage

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

Valore proprietà

Tipo: System.Drawing.Image

Oggetto Image che rappresenta l'immagine da visualizzare sullo sfondo della forma.

Note

Utilizzare la proprietà BackgroundImage per inserire un'immagine grafica in una forma.

Nota:

L'impostazione della proprietà BackgroundImage esegue l'override di tutte le impostazioni delle proprietà BackColor, BackStyle, FillColor, FillGradientColor, FillGradientStyle e FillStyle.

Note per gli eredi:

Quando si esegue l'override della proprietà BackgroundImage in una classe derivata, utilizzare la proprietà BackgroundImage della classe base per estendere l'implementazione base. In caso contrario, sarà necessario fornire l'intera implementazione. Non è necessario eseguire l'override di entrambe le funzioni di accesso get e set della proprietà BackgroundImage. È possibile eseguire l'override di una soltanto, se necessario.

Esempi

Nell'esempio riportato di seguito viene mostrato come utilizzare le proprietà BackgroundImage e BackgroundImageLayout per visualizzare un'immagine in una forma. Per questo esempio è necessario disporre in un form di un controllo OvalShape denominato OvalShape1 e il progetto deve contenere una risorsa immagine denominata 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;
}

Autorizzazioni

Vedere anche

Riferimenti

SimpleShape Classe

Membri SimpleShape

Spazio dei nomi Microsoft.VisualBasic.PowerPacks

Altre risorse

Introduzione ai controlli Line e Shape (Visual Studio)

Procedura: disegnare linee con il controllo LineShape (Visual Studio)

Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)

Procedura: aggiungere immagini di sfondo a un Windows Form