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

特定控制項的 Chrome 型別,其中一個 PartChromeType 列舉值。

傳回

Style,其中包含 catalogPart 的樣式屬性。

例外狀況

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

備註

方法 CreateCatalogPartChromeStyleStyle 建立 物件用來 CatalogPartChrome 呈現 CatalogPart 控制項的 物件。

給繼承者的注意事項

如果您繼承自 CatalogPartChrome 類別,您可以選擇性地覆寫 CreateCatalogPartChromeStyle(CatalogPart, PartChromeType) 方法,並將基底方法中的樣式資訊與您想要新增的自訂樣式屬性合併。 如需示範,請參閱一節。

適用於