PanelStyle.BackImageUrl Vlastnost

Definice

Získá nebo nastaví adresu URL obrázku pozadí pro ovládací prvek panel.

public:
 virtual property System::String ^ BackImageUrl { System::String ^ get(); void set(System::String ^ value); };
public virtual string BackImageUrl { get; set; }
member this.BackImageUrl : string with get, set
Public Overridable Property BackImageUrl As String

Hodnota vlastnosti

Adresa URL obrázku pozadí ovládacího prvku panel. Výchozí hodnota je prázdný řetězec ("").

Výjimky

Vlastnost BackImageUrl je null.

Příklady

Následující příklad kódu použije stejný obrázek pozadí na dva ovládací prvky Panel1 panelu a Panel2. Aby tento příklad fungoval správně, musíte zadat vlastní image. Tento příklad kódu je součástí většího příkladu PanelStyle pro třídu.

public partial class PanelStylecs_aspx : Page
{
    void Page_Load(object sender, EventArgs e)
    {
        StateBag panelState = new StateBag();
        PanelStyle myPanelStyle = new PanelStyle(panelState);
        
        // Set the properties of the PanelStyle class.
        myPanelStyle.HorizontalAlign = HorizontalAlign.Center;
        myPanelStyle.ScrollBars = ScrollBars.Both;
        myPanelStyle.Wrap = false;
        myPanelStyle.Direction = ContentDirection.LeftToRight;
        myPanelStyle.BackImageUrl = @"~\images\picture.jpg";

        // Use the ApplyStyle method of the Panel control to apply
        // the settings from the myPanelStyle object.
        Panel1.ApplyStyle(myPanelStyle);
        Panel2.ApplyStyle(myPanelStyle); 
    }
}
Partial Class PanelStylevb_aspx
    Inherits Page

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        Dim panelState As StateBag = New StateBag()
        Dim myPanelStyle As PanelStyle = New PanelStyle(panelState)

        ' Set the properties of the PanelStyle class.
        myPanelStyle.HorizontalAlign = HorizontalAlign.Center
        myPanelStyle.ScrollBars = ScrollBars.Both
        myPanelStyle.Wrap = False
        myPanelStyle.Direction = ContentDirection.LeftToRight
        myPanelStyle.BackImageUrl = "~\images\picture.jpg"

        ' Use the ApplyStyle method of the Panel control to apply
        ' the settings from the myPanelStyle object.
        Panel1.ApplyStyle(myPanelStyle)
        Panel2.ApplyStyle(myPanelStyle)
        
    End Sub

End Class

Poznámky

Vlastnost BackImageUrl určuje adresu URL obrázku pozadí ovládacího prvku panel. Aby tato vlastnost fungovala, musí v zadaném umístění existovat soubor obrázku. Pokud zadaný soubor obrázku není přístupný, zobrazí se ovládací prvek panelu bez obrázku na pozadí.

Platí pro