Condividi tramite


Proprietà SimpleShape.BackgroundImage

Ottiene o imposta l'immagine visualizzata in una forma.

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

Sintassi

'Dichiarazione
<BrowsableAttribute(True)> _
Public Property BackgroundImage As Image
[BrowsableAttribute(true)]
public Image BackgroundImage { get; set; }
[BrowsableAttribute(true)]
public:
property Image^ BackgroundImage {
    Image^ get ();
    void set (Image^ value);
}
[<BrowsableAttribute(true)>]
member BackgroundImage : Image with get, set
function get BackgroundImage () : Image 
function set BackgroundImage (value : Image)

Valore proprietà

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

Note

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

Nota

Impostare il BackgroundImage proprietà esegue l'override di tutte le impostazioni per il BackColor, BackStyle, FillColor, FillGradientColor, FillGradientStyle, e FillStyle proprietà.

Note per gli eredi

Quando sottoposto a override il BackgroundImage proprietà in una classe derivata, utilizzare il BackgroundImage proprietà della classe di base per estendere l'implementazione di base. In caso contrario, è necessario fornire l'implementazione completa. Non è necessario eseguire l'override sia a get e set di funzioni di accesso il BackgroundImage proprietà. è possibile sostituire un solo se è necessario.

Esempi

Nell'esempio seguente viene illustrato come utilizzare il BackgroundImage e BackgroundImageLayout proprietà per visualizzare un'immagine su una forma. Si suppone di disporre di un OvalShape controllo denominato OvalShape1 in un form e che il progetto contiene una risorsa immagine denominata 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;
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

SimpleShape Classe

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