Part.ChromeType プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
Dim instance As Part Dim value As PartChromeType value = instance.ChromeType instance.ChromeType = value
public: virtual property PartChromeType ChromeType { PartChromeType get (); void set (PartChromeType value); }
/** @property */ public PartChromeType get_ChromeType () /** @property */ public void set_ChromeType (PartChromeType value)
public function get ChromeType () : PartChromeType public function set ChromeType (value : PartChromeType)
PartChromeType 値の 1 つ。既定値は Default です。
解説
パーツ コントロールの周囲に表示する境界線の種類は、コントロールの ChromeType プロパティによって決まります。使用できるオプションには、タイトルのみ表示、境界線のみ表示、タイトルと境界線を表示、何も表示しない、または既定のオプション (単に PartChromeType プロパティの値を使用) があります。
継承時の注意 WebPart などの派生クラスでは、ChromeType をオーバーライドして、コントロールを囲む境界線の種類をユーザーがパーソナル化できるようにできます。パーツ コントロールで、ChromeType プロパティを宣言によって使用するコード例を次に示します。この例には、TextDisplayWebPart というカスタムの WebPart コントロールが必要です。これについては、Part クラスの概要にある「例」を参照してください。
Web ページの宣言コードで、TextDisplayWebPart コントロールの 2 番目のインスタンスでは、ChromeType プロパティがタイトルのみ表示するように設定されています。これに対して、最初のインスタンスでは、タイトルと境界線を表示するように設定されています。ブラウザでページを読み込むと、コントロールの 2 番目のインスタンスは、最小化された状態で表示されます。このコントロールを最大化すると、タイトルが表示され、境界線は表示されません。
<%@ page language="VB" %> <%@ register tagprefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="TextDisplayWebPartVB" %> <html> <head id="Head1" runat="server"> </head> <body> <form id="Form1" runat="server"> <asp:webpartmanager id="WebPartManager1" runat="server" /> <asp:webpartzone id="WebPartZone1" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart" title = "Text Content WebPart" Description="A text content WebPart control." ChromeType="TitleAndBorder" width="350px" /> </zonetemplate> </asp:webpartzone> <asp:webpartzone id="WebPartZone2" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart2" title = "Text Content WebPart 2" Description="A text content WebPart control." ChromeType="TitleOnly" ChromeState="Minimized" width="350px" /> </zonetemplate> </asp:webpartzone> </form> </body> </html>
<%@ page language="C#" %> <%@ register tagprefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="TextDisplayWebPartCS" %> <html> <head id="Head1" runat="server"> </head> <body> <form id="Form1" runat="server"> <asp:webpartmanager id="WebPartManager1" runat="server" /> <asp:webpartzone id="WebPartZone1" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart" title = "Text Content WebPart" Description="A text content WebPart control." ChromeType="TitleAndBorder" width="350px" /> </zonetemplate> </asp:webpartzone> <asp:webpartzone id="WebPartZone2" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart2" title = "Text Content WebPart 2" Description="A text content WebPart control." ChromeType="TitleOnly" ChromeState="Minimized" width="350px" /> </zonetemplate> </asp:webpartzone> </form> </body> </html>
<%@ page language="VJ#" %> <%@ register tagprefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="TextDisplayWebPartJSL" %> <html> <head id="Head1" runat="server"> </head> <body> <form id="Form1" runat="server"> <asp:webpartmanager id="WebPartManager1" runat="server" /> <asp:webpartzone id="WebPartZone1" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart" title = "Text Content WebPart" Description="A text content WebPart control." ChromeType="TitleAndBorder" width="350px" /> </zonetemplate> </asp:webpartzone> <asp:webpartzone id="WebPartZone2" runat="server" backcolor="#99cccc"> <parttitlestyle font-bold="true" forecolor="#ffffff" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:TextDisplayWebPart runat="server" id="textwebpart2" title = "Text Content WebPart 2" Description="A text content WebPart control." ChromeType="TitleOnly" ChromeState="Minimized" width="350px" /> </zonetemplate> </asp:webpartzone> </form> </body> </html>
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- Part.ChromeType プロパティのページへのリンク