語言

CatalogPartChrome.CreateCatalogPartChromeStyle 方法

定義

建立樣式物件,為物件渲染CatalogPart的每個CatalogPartChrome控制項提供樣式屬性。

protected:
 virtual System::Web::UI::WebControls::Style ^ CreateCatalogPartChromeStyle(System::Web::UI::WebControls::WebParts::CatalogPart ^ catalogPart, System::Web::UI::WebControls::WebParts::PartChromeType chromeType);
protected virtual System.Web.UI.WebControls.Style CreateCatalogPartChromeStyle(System.Web.UI.WebControls.WebParts.CatalogPart catalogPart, System.Web.UI.WebControls.WebParts.PartChromeType chromeType);
abstract member CreateCatalogPartChromeStyle : System.Web.UI.WebControls.WebParts.CatalogPart * System.Web.UI.WebControls.WebParts.PartChromeType -> System.Web.UI.WebControls.Style
override this.CreateCatalogPartChromeStyle : System.Web.UI.WebControls.WebParts.CatalogPart * System.Web.UI.WebControls.WebParts.PartChromeType -> System.Web.UI.WebControls.Style
Protected Overridable Function CreateCatalogPartChromeStyle (catalogPart As CatalogPart, chromeType As PartChromeType) As Style

參數

catalogPart
CatalogPart

目前正在渲染的控制權。

chromeType
PartChromeType

針對特定控制的鍍鉻類型;其中一個 PartChromeType 列舉值。

傳回

Style包含 的catalogPart樣式屬性的 A。

例外狀況

所 catalogPart 指的控制是 null。

範例

以下程式碼範例示範如何覆寫 CreateCatalogPartChromeStyle 改變目錄零件控制背景色的方法。 關於執行範例所需的完整程式碼,包括用於承載這些控制項的網頁,請參閱類別總覽中的 CatalogPartChrome 範例部分。

protected override Style  CreateCatalogPartChromeStyle(CatalogPart catalogPart, PartChromeType chromeType)
{
    Style catalogStyle = base.CreateCatalogPartChromeStyle(catalogPart, chromeType);
    catalogStyle.BackColor = Color.Bisque;
    return catalogStyle;
}
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

備註

此方法會 CreateCatalogPartChromeStyle 建立 Style 一個物件,物件用 CatalogPartChrome 來渲染控制項 CatalogPart 。

給繼承者的注意事項

如果你繼承了 CatalogPartChrome 這個類別,你可以選擇覆蓋該方法, CreateCatalogPartChromeStyle(CatalogPart, PartChromeType) 並將基礎方法的樣式資訊與你想加入的自訂樣式屬性合併。 示範請參見範例部分。

適用於