PanelStyle.BackImageUrl Egenskap

Definition

Hämtar eller anger URL:en för bakgrundsbilden för panelkontrollen.

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

Egenskapsvärde

URL:en för bakgrundsbilden för panelkontrollen. Standardvärdet är en tom sträng ("").

Undantag

Egenskapen BackImageUrl är null.

Exempel

Följande kodexempel tillämpar samma bakgrundsbild på två panelkontroller Panel1 och Panel2. För att det här exemplet ska fungera korrekt måste du ange en egen avbildning. Det här kodexemplet är en del av ett större exempel för PanelStyle klassen.

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

Kommentarer

Egenskapen BackImageUrl anger URL:en för bakgrundsbilden för panelkontrollen. För att den här egenskapen ska fungera måste det finnas en bildfil på den angivna platsen. Om den angivna bildfilen inte är tillgänglig visas panelkontrollen utan en bakgrundsbild.

Gäller för