PanelStyle.HorizontalAlign Propriedade

Definição

Obtém ou define o alinhamento horizontal do conteúdo no controle de painel.

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 da propriedade

HorizontalAlign

Um dos valores de HorizontalAlign. O padrão é NotSet.

Exceções

O alinhamento horizontal não é um dos valores HorizontalAlign.

Exemplos

O exemplo de código a seguir define as HorizontalAlign propriedades de dois controles Panel1 de painel e Panel2o valor da HorizontalAlign.Center enumeração. Para obter um arquivo .aspx que pode ser usado para executar o exemplo, consulte o PanelStyle tópico.

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

Comentários

A HorizontalAlign propriedade especifica o alinhamento horizontal do conteúdo em um controle de painel.

A HorizontalAlign propriedade é definida usando um dos valores de HorizontalAlign enumeração. A tabela a seguir lista os valores possíveis.

Valor Descrição
NotSet O alinhamento horizontal não foi definido.
Left O conteúdo do painel é alinhado à esquerda.
Center O conteúdo do painel é centralizado.
Right O conteúdo do painel está alinhado à direita.

Observação

. Se a HorizontalAlign propriedade estiver definida como NotSet , mas a propriedade estiver definida no controle que contém o controle do painel, a configuração será herdada do controle independente.

Aplica-se a

Confira também