CatalogPartChromeとは? わかりやすく解説

CatalogPartChrome クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

開発者が、CatalogZoneBase ゾーン内の CatalogPart コントロール選択したセクション表示だけをオーバーライドできるようにします。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class CatalogPartChrome
Dim instance As CatalogPartChrome
public class CatalogPartChrome
public ref class CatalogPartChrome
public class CatalogPartChrome
public class CatalogPartChrome
解説解説

クロムとは、ゾーン内に含まれるWeb パーツ コントロールまたはサーバー コントロール周囲表示する周辺ユーザー インターフェイス (UI: User Interface) 要素のことです。コントロールクロムには、境界線タイトル バーアイコンタイトル テキストがあり、さらにはタイトル バー表示される動詞メニュー含まれます。クロム外観は、ゾーン レベルに対して設定されゾーン内のすべてのコントロール適用されます。

Web パーツ コントロール セットは、CatalogPartChrome クラス使用して CatalogPart コントロールクロム表示します。さらに、このクラス使用すると、開発者CatalogZoneBase ゾーン内の任意の CatalogPart コントロール表示カスタマイズできます。たとえば、CreateCatalogPartChromeStyle メソッドオーバーライドして、CatalogZoneBase ゾーン適用されている特定のスタイル属性一部カスタマイズできます

CatalogPartChrome クラスには、CatalogPart コントロール表示オーバーライドする場合に役立つ複数重要なメソッド含まれています。その 1 つは、CatalogPartChrome コンストラクタです。このコンストラクタは、カスタム CatalogZoneBase ゾーンの CreateCatalogPartChrome メソッドオーバーライドして、カスタム CatalogPartChrome オブジェクトインスタンス作成する場合使用します。また RenderPartContents メソッド役立ちます。このメソッドは、 ヘッダーフッタータイトル バーなどのクロム要素とは異なるように、ゾーン内の コントロールコンテンツ領域表示制御する場合使用できます最後にCatalogPart コントロール表示あらゆる要素プログラムで完全に制御する場合には、RenderCatalogPart メソッドオーバーライドできます

実装時の注意 CatalogPartChrome クラスから継承する場合は、カスタマイズしたCatalogZone ゾーン作成しカスタマイズした CatalogPartChrome クラス返す必要があります。このクラス概要の「例」は、カスタマイズした CatalogZone ゾーン作成しカスタマイズした CatalogPartChrome クラス返す方法示してます。

使用例使用例

CatalogPartChrome クラス使用して CatalogZoneBase ゾーンCatalogPart コントロール既定表示オーバーライドする方法次のコード例示します

コード例は、次の 3 つの部分から成ります

コード例最初部分は、ユーザー コントロールです。ユーザー コントロールソース コードは、別のトピックのものを使用してます。このコード例実行するには、チュートリアル : Web パーツ ページでの表示モード変更トピック記載されているユーザー コントロール.ascx ファイルを、このコード例示されている .ascx ページと同じフォルダ配置する必要があります

コード例2 番目の部分Web ページです。コンパイルしたコンポーネントタグ プリフィックス登録するため、ファイル先頭近くには、Register ディレクティブ存在しますまた、このページは、<aspSample:MyCatalogZone> 要素使用してカスタム カタログ ゾーン参照します。

<html>
<head id="Head1" runat="server">
  <title>Web Parts Page</title>
</head>
<body>
  <h1>Web Parts Demonstration Page</h1>
  <form runat="server" id="form1">
<asp:webpartmanager id="WebPartManager1" runat="server"
 />
<uc1:DisplayModeMenuVB runat=server ID="DisplayModeMenu"
 />
  <br />
  <table cellspacing="0" cellpadding="0"
 border="0">
    <tr>
      <td valign="top">
    <asp:webpartzone id="SideBarZone" runat="server"
 
        headertext="Sidebar">
        <zonetemplate>
        </zonetemplate>
      </asp:webpartzone>
      <aspSample:MyCatalogZone ID="CatalogZone1"
 runat="server">
      <ZoneTemplate>
          <asp:ImportCatalogPart ID="ImportCatalog"
 runat="server" />
      </ZoneTemplate>
    </aspSample:MyCatalogZone>
      </td>
      <td valign="top">
    <asp:webpartzone id="MainZone" runat="server"
 headertext="Main">
         <zonetemplate>
        <asp:label id="contentPart" runat="server"
 title="Content">
              <h2>Welcome to My Home Page</h2>
              <p>Use links to visit my favorite sites!</p>
            </asp:label>
         </zonetemplate>
       </asp:webpartzone>
      </td>
      <td valign="top">
      </td>
    </tr>
  </table>
  </form>
</body>
</html>
<%@ Page Language="VB" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.VB.Controls"
 %>
<%@ Register TagPrefix="uc1" TagName="DisplayModeMenuVB"
 Src="~/DisplayModeMenuVB.ascx" %>
<html>
<head id="Head1" runat="server">
  <title>Web Parts Page</title>
</head>
<body>
  <h1>Web Parts Demonstration Page</h1>
  <form runat="server" id="form1">
<asp:webpartmanager id="WebPartManager1" runat="server"
 />
<uc1:DisplayModeMenuVB runat=server ID="DisplayModeMenu"
 />
  <br />
  <table cellspacing="0" cellpadding="0"
 border="0">
    <tr>
      <td valign="top">
    <asp:webpartzone id="SideBarZone" runat="server"
 
        headertext="Sidebar">
        <zonetemplate>
        </zonetemplate>
      </asp:webpartzone>
      <aspSample:MyCatalogZone ID="CatalogZone1"
 runat="server">
      <ZoneTemplate>
          <asp:ImportCatalogPart ID="ImportCatalog"
 runat="server" />
      </ZoneTemplate>
    </aspSample:MyCatalogZone>
      </td>
      <td valign="top">
    <asp:webpartzone id="MainZone" runat="server"
 headertext="Main">
         <zonetemplate>
        <asp:label id="contentPart" runat="server"
 title="Content">
              <h2>Welcome to My Home Page</h2>
              <p>Use links to visit my favorite sites!</p>
            </asp:label>
         </zonetemplate>
       </asp:webpartzone>
      </td>
      <td valign="top">
      </td>
    </tr>
  </table>
  </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.CS.Controls" %>
<%@ Register TagPrefix="uc1" TagName="DisplayModeMenuCS" Src="~/DisplayModeMenuCS.ascx"
 %>
<html>
<head id="Head1" runat="server">
  <title>Web Parts Page</title>
</head>
<body>
  <h1>Web Parts Demonstration Page</h1>
  <form runat="server" id="form1">
<asp:webpartmanager id="WebPartManager1" runat="server" />
<uc1:DisplayModeMenuCS runat=server ID="DisplayModeMenu" />
  <br />
  <table cellspacing="0" cellpadding="0" border="0">
    <tr>
      <td valign="top">
    <asp:webpartzone id="SideBarZone" runat="server" 
        headertext="Sidebar">
        <zonetemplate>
        </zonetemplate>
      </asp:webpartzone>
      <aspSample:MyCatalogZone ID="CatalogZone1" runat="server">
      <ZoneTemplate>
          <asp:ImportCatalogPart ID="ImportCatalog" runat="server"
 />
      </ZoneTemplate>
    </aspSample:MyCatalogZone>
      </td>
      <td valign="top">
    <asp:webpartzone id="MainZone" runat="server" headertext="Main">
         <zonetemplate>
        <asp:label id="contentPart" runat="server" title="Content">
              <h2>Welcome to My Home Page</h2>
              <p>Use links to visit my favorite sites!</p>
            </asp:label>
         </zonetemplate>
       </asp:webpartzone>
      </td>
      <td valign="top">
      </td>
    </tr>
  </table>
  </form>
</body>
</html>

コード例3 番目の部分には、カスタムカタログ パーツ クロムおよびカタログ パーツ ゾーン実装含まれています。MyCatalogZoneCatalogZone拡張して CreateCatalogPartChromeオーバーライドし、カスタムカタログ パーツ クロム返しますMyCatalogPartChrome は、CreateCatalogPartChromeStyle メソッドカタログ コントロール背景色変更しますゾーン背景色は PerformPreRender メソッド変更しテキストRenderPartContents メソッドカタログ パーツ追加されます。

Namespace Samples.AspNet.VB.Controls


    Public Class MyCatalogPartChrome
        Inherits CatalogPartChrome

        Public Sub New(ByVal
 zone As CatalogZoneBase)
            MyBase.New(zone)
        End Sub

        Protected Overrides Function
 CreateCatalogPartChromeStyle(ByVal catalogPart As
 System.Web.UI.WebControls.WebParts.CatalogPart, ByVal chromeType As System.Web.UI.WebControls.WebParts.PartChromeType) As
 System.Web.UI.WebControls.Style
            Dim editorStyle As Style
            editorStyle = MyBase.CreateCatalogPartChromeStyle(catalogPart,
 chromeType)
            editorStyle.BackColor = Drawing.Color.Bisque
            Return editorStyle
        End Function

        Public Overrides Sub
 PerformPreRender()
            Dim zoneStyle As Style = New
 Style
            zoneStyle.BackColor = Drawing.Color.Cornsilk

            Zone.Page.Header.StyleSheet.RegisterStyle(zoneStyle, Nothing)
            Zone.MergeStyle(zoneStyle)
        End Sub

        Protected Overrides Sub
 RenderPartContents(ByVal writer As System.Web.UI.HtmlTextWriter,
 ByVal catalogPart As System.Web.UI.WebControls.WebParts.CatalogPart)
            writer.AddStyleAttribute("color", "red")
            writer.RenderBeginTag("p")
            writer.Write("Apply all changes")
            writer.RenderEndTag()
            catalogPart.RenderControl(writer)
        End Sub

        Public Overrides Sub
 RenderCatalogPart(ByVal writer As System.Web.UI.HtmlTextWriter,
 ByVal catalogPart As System.Web.UI.WebControls.WebParts.CatalogPart)
            MyBase.RenderCatalogPart(writer, catalogPart)
        End Sub
    End Class

    Public Class MyCatalogZone
        Inherits CatalogZone

        Protected Overrides Function
 CreateCatalogPartChrome() As System.Web.UI.WebControls.WebParts.CatalogPartChrome
            Return New MyCatalogPartChrome(Me)
        End Function
    End Class
End Namespace
namespace Samples.AspNet.CS.Controls
{

    /// <summary>
    /// Summary description for source
    /// </summary>
    public class MyCatalogPartChrome : CatalogPartChrome
    {
        public MyCatalogPartChrome(CatalogZoneBase zone)
            : base(zone)
        {

        }

        protected override Style  CreateCatalogPartChromeStyle(CatalogPart
 catalogPart, PartChromeType chromeType)
        {
            Style catalogStyle = base.CreateCatalogPartChromeStyle(catalogPart,
 chromeType);
            catalogStyle.BackColor = Color.Bisque;
            return catalogStyle;
        }

        public override void PerformPreRender()
        {
            Style zoneStyle = new Style();
            zoneStyle.BackColor = Color.Cornsilk;

            Zone.Page.Header.StyleSheet.RegisterStyle(zoneStyle, null);
            Zone.MergeStyle(zoneStyle);
        }

        protected override void  RenderPartContents(HtmlTextWriter
 writer, CatalogPart catalogPart)
        {
            writer.AddStyleAttribute("color", "red");
            writer.RenderBeginTag("p");
            writer.Write("Apply all changes");
            writer.RenderEndTag();
            catalogPart.RenderControl(writer);
        }

        public override void  RenderCatalogPart(HtmlTextWriter
 writer, CatalogPart catalogPart)
        {
            base.RenderCatalogPart(writer, catalogPart);
        }
    }

    public class MyCatalogZone : CatalogZone
    {
        protected override CatalogPartChrome  CreateCatalogPartChrome()
        {
            return new MyCatalogPartChrome(this);
        }
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.WebControls.WebParts.CatalogPartChrome
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CatalogPartChrome メンバ
System.Web.UI.WebControls.WebParts 名前空間
CreateCatalogPartChrome
CatalogPart クラス
WebPartChrome
EditorPartChrome
その他の技術情報
ASP.NET Web パーツ ページ

CatalogPartChrome コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

CatalogPartChrome クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    zone As CatalogZoneBase _
)
Dim zone As CatalogZoneBase

Dim instance As New CatalogPartChrome(zone)
public CatalogPartChrome (
    CatalogZoneBase zone
)
public:
CatalogPartChrome (
    CatalogZoneBase^ zone
)
public CatalogPartChrome (
    CatalogZoneBase zone
)
public function CatalogPartChrome (
    zone : CatalogZoneBase
)

パラメータ

zone

関連付けられた CatalogZoneBase。

例外例外
例外種類条件

ArgumentNullException

zone参照する CatalogZoneBasenull 参照 (Visual Basic では Nothing) です。

解説解説

CatalogPartChrome コンストラクタは、CatalogPartChrome クラス新しインスタンス初期化します。これは、主に CatalogZoneBase ゾーンによってその CreateCatalogPartChrome メソッド内で使用されクロムレンダリングおよびそのゾーン内の CatalogPart コントロール任意のカスタム レンダリング処理する CatalogPartChrome オブジェクトインスタンス作成します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CatalogPartChrome クラス
CatalogPartChrome メンバ
System.Web.UI.WebControls.WebParts 名前空間

CatalogPartChrome プロパティ


プロテクト プロパティプロテクト プロパティ

  名前 説明
プロテクト プロパティ Zone 関連付けられた CatalogZoneBase ゾーンへの参照取得します
参照参照

関連項目

CatalogPartChrome クラス
System.Web.UI.WebControls.WebParts 名前空間
CreateCatalogPartChrome
CatalogPart クラス
WebPartChrome
EditorPartChrome

その他の技術情報

ASP.NET Web パーツ ページ

CatalogPartChrome メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CatalogPartChrome クラス
System.Web.UI.WebControls.WebParts 名前空間
CreateCatalogPartChrome
CatalogPart クラス
WebPartChrome
EditorPartChrome

その他の技術情報

ASP.NET Web パーツ ページ

CatalogPartChrome メンバ

開発者が、CatalogZoneBase ゾーン内の CatalogPart コントロール選択したセクション表示だけをオーバーライドできるようにします。

CatalogPartChrome データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CatalogPartChrome CatalogPartChrome クラス新しインスタンス初期化します。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ Zone 関連付けられた CatalogZoneBase ゾーンへの参照取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CatalogPartChrome クラス
System.Web.UI.WebControls.WebParts 名前空間
CreateCatalogPartChrome
CatalogPart クラス
WebPartChrome
EditorPartChrome

その他の技術情報

ASP.NET Web パーツ ページ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CatalogPartChrome」の関連用語

CatalogPartChromeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CatalogPartChromeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS