Bagikan melalui


PanelStyle.Wrap Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan apakah konten membungkus dalam panel.

public:
 virtual property bool Wrap { bool get(); void set(bool value); };
public virtual bool Wrap { get; set; }
member this.Wrap : bool with get, set
Public Overridable Property Wrap As Boolean

Nilai Properti

true jika konten membungkus dalam panel; jika tidak, false. Defaultnya adalah true.

Contoh

Contoh kode berikut mengatur Wrap properti ke false untuk dua kontrol panel, Panel1 dan Panel2. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk PanelStyle kelas .

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

Keterangan

Properti Wrap menunjukkan apakah konten membungkus dalam panel. Wrap Ketika properti diatur ke false dan ScrollBars properti diatur ke Auto, jika konten panel lebih panjang dari apa yang akan pas di panel, konten panel akan muncul pada satu baris dengan bilah gulir horizontal. Wrap Ketika properti diatur ke false dan ScrollBars properti diatur ke None, panel akan diperluas dan jika perlu halaman Web akan memiliki bilah gulir horizontal.

Berlaku untuk