PanelStyle.BackImageUrl Właściwość

Definicja

Pobiera lub ustawia adres URL obrazu tła dla kontrolki panelu.

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

Wartość właściwości

Adres URL obrazu tła dla kontrolki panelu. Wartością domyślną jest ciąg pusty ("").

Wyjątki

Właściwość BackImageUrl to null.

Przykłady

Poniższy przykład kodu stosuje ten sam obraz tła do dwóch kontrolek Panel1 panelu i Panel2. Aby ten przykład działał poprawnie, musisz podać własny obraz. Ten przykład kodu jest częścią większego przykładu podanego PanelStyle dla klasy.

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

Uwagi

Właściwość BackImageUrl określa adres URL obrazu tła dla kontrolki panelu. Aby ta właściwość działała, plik obrazu musi istnieć w określonej lokalizacji. Jeśli określony plik obrazu jest niedostępny, kontrolka panelu jest wyświetlana bez obrazu tła.

Dotyczy