PanelStyle クラス
アセンブリ: System.Web (system.web.dll 内)


PanelStyle クラスは、パネル コントロールのスタイル設定を表すために使用されます。このクラスは、パネルの外観を制御するプロパティをカプセル化し、共通の外観を指定する複数のパネル コントロールに適用できます。
パネルの背景に表示するイメージを指定するには、BackImageUrl プロパティを設定します。パネルの内容の水平方向の配置は、HorizontalAlign プロパティで示されます。テキストが含まれるコントロールのパネル コントロール内での方向を指定するには、Direction プロパティを設定します。

PanelStyle オブジェクトの作成とそのプロパティ設定を行うコード例を次に示します。この例は、次の 2 つの部分で構成されます。
新しい PanelStyle オブジェクトの作成とそのプロパティの設定方法を示す部分クラスである PanelStylecs_aspx。
コード例の PanelStylecs_aspx を分離コード ファイルとして使用する Web フォーム ページ。
この例の最初の部分は、PanelStyle オブジェクトの作成、myPanelStyle、およびプロパティの設定を示します。ApplyStyle メソッドが Panel1 パネルと Panel2 パネルの両方に対して呼び出され、その両方に 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
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); } }
この例の 2 番目の部分では、前の例で使用される .aspx ファイルを示します。
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="PanelStyle.vb" Inherits="PanelStylevb_aspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <body> <form id="form1" runat="server"> <h3>PanelStyle Example</h3> <asp:Panel id="Panel1" runat="server" width="150" height="50"> This is the Panel1 panel control. </asp:Panel> <br /><br /> <asp:Panel id="Panel2" runat="server" width="150" height="50"> This is the Panel2 panel control. </asp:Panel> </form> </body> </html>
<%@ Page Language="C#" CodeFile="PanelStyle.cs" Inherits="PanelStylecs_aspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <body> <form id="form1" runat="server"> <h3>PanelStyle Example</h3> <asp:Panel id="Panel1" runat="server" width="150" height="50"> This is the Panel1 panel control. </asp:Panel> <br /><br /> <asp:Panel id="Panel2" runat="server" width="150" height="50"> This is the Panel2 panel control. </asp:Panel> </form> </body> </html>


System.MarshalByRefObject
System.ComponentModel.Component
System.Web.UI.WebControls.Style
System.Web.UI.WebControls.PanelStyle


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からPanelStyle クラスを検索する場合は、下記のリンクをクリックしてください。

- PanelStyle クラスのページへのリンク