PanelStyle.HorizontalAlign Propiedad

Definición

Obtiene o establece la alineación horizontal del contenido dentro de un control de panel.

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

Valor de propiedad

HorizontalAlign

Uno de los valores de HorizontalAlign. De manera predeterminada, es NotSet.

Excepciones

La alineación horizontal no se corresponde con ninguno de los valores HorizontalAlign.

Ejemplos

En el ejemplo de código siguiente se establecen las HorizontalAlign propiedades de dos controles de panel y Panel1 Panel2, en el valor de HorizontalAlign.Center enumeración. Para ver un archivo .aspx que se puede usar para ejecutar el ejemplo, consulte el PanelStyle tema.

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

Comentarios

La HorizontalAlign propiedad especifica la alineación horizontal del contenido dentro de un control de panel.

La HorizontalAlign propiedad se establece mediante uno de los HorizontalAlign valores de enumeración. En la tabla siguiente se enumeran los valores posibles.

Valor Descripción
NotSet No se ha establecido la alineación horizontal.
Left El contenido del panel está alineado a la izquierda.
Center El contenido del panel se centra.
Right El contenido del panel está alineado a la derecha.

Nota

. Si la HorizontalAlign propiedad se establece NotSet en pero la propiedad se establece en el control que contiene el control de panel, el valor se hereda del control contenedor.

Se aplica a

Consulte también