Partager via


PanelStyle.HorizontalAlign Propriété

Définition

Obtient ou définit l’alignement horizontal du contenu dans un contrôle de panneau.

public:
 virtual property System::Web::UI::WebControls::HorizontalAlign HorizontalAlign { System::Web::UI::WebControls::HorizontalAlign get(); void set(System::Web::UI::WebControls::HorizontalAlign value); };
public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }
member this.HorizontalAlign : System.Web.UI.WebControls.HorizontalAlign with get, set
Public Overridable Property HorizontalAlign As HorizontalAlign

Valeur de propriété

Une des HorizontalAlign valeurs. La valeur par défaut est NotSet.

Exceptions

L’alignement horizontal n’est pas l’une HorizontalAlign des valeurs.

Exemples

L’exemple de code suivant définit les HorizontalAlign propriétés de deux contrôles de panneau et Panel1Panel2, sur la valeur d’énumération HorizontalAlign.Center . Pour obtenir un fichier .aspx qui peut être utilisé pour exécuter l’exemple, consultez la PanelStyle rubrique.

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

Remarques

La HorizontalAlign propriété spécifie l’alignement horizontal du contenu dans un contrôle de panneau.

La HorizontalAlign propriété est définie à l’aide de l’une HorizontalAlign des valeurs d’énumération. Le tableau suivant répertorie les valeurs possibles.

Valeur Description
NotSet L’alignement horizontal n’est pas défini.
Left Le contenu du panneau est aligné à gauche.
Center Le contenu du panneau est centré.
Right Le contenu du panneau est aligné à droite.

Note

. Si la HorizontalAlign propriété est définie NotSet mais que la propriété est définie dans le contrôle qui contient le contrôle du panneau, le paramètre est hérité du contrôle conteneur.

S’applique à

Voir aussi