PanelStyle.HorizontalAlign プロパティ

定義

パネル コントロールの内容の水平方向の配置を取得または設定します。

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

プロパティ値

HorizontalAlign

HorizontalAlign 値のいずれか 1 つ。 既定値は、NotSet です。

例外

水平方向の配置は、HorizontalAlign 値ではありません。

次のコード例では、2 つのパネル コントロールのプロパティとPanel2Panel1列挙値をHorizontalAlign.Center設定HorizontalAlignします。 例の実行に使用できる .aspx ファイルについては、トピックを PanelStyle 参照してください。

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

注釈

このプロパティは HorizontalAlign 、パネル コントロール内のコンテンツの水平方向の配置を指定します。

プロパティは HorizontalAlign 、列挙値のいずれかを使用して設定されます HorizontalAlign 。 次の表に、使用可能な値を示します。

説明
NotSet 水平方向の配置は設定されていません。
Left パネルの内容は左揃えです。
Center パネルの内容は中央揃えです。
Right パネルの内容は右揃えです。

注意

. プロパティが HorizontalAlign 設定 NotSet されていても、そのプロパティがパネル コントロールを含むコントロールで設定されている場合、設定は含まれているコントロールから継承されます。

適用対象

こちらもご覧ください