EditorPartChrome.CreateEditorPartChromeStyle 方法

定義

建立樣式物件,該樣式物件為 EditorPart 物件呈現的每一個 EditorPartChrome 控制項提供樣式屬性。

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

參數

editorPart
EditorPart

目前正在呈現的控制項。

chromeType
PartChromeType

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

傳回

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

例外狀況

editorPart 參考的控制項是 null

範例

下列程式碼範例示範如何覆寫 CreateEditorPartChromeStyle 方法來變更編輯器元件控制項的背景色彩。 如需執行範例所需的完整程式碼,包括裝載這些控制項的網頁,請參閱類別概觀的 EditorPartChrome 範例一節。

protected override Style CreateEditorPartChromeStyle(EditorPart editorPart, PartChromeType chromeType)
{
    Style editorStyle = base.CreateEditorPartChromeStyle(editorPart, chromeType);
    editorStyle.BackColor = Color.Bisque;
    return editorStyle;
}
Protected Overrides Function CreateEditorPartChromeStyle(ByVal editorPart As System.Web.UI.WebControls.WebParts.EditorPart, ByVal chromeType As System.Web.UI.WebControls.WebParts.PartChromeType) As System.Web.UI.WebControls.Style
    Dim editorStyle As Style
    editorStyle = MyBase.CreateEditorPartChromeStyle(editorPart, chromeType)
    editorStyle.BackColor = Drawing.Color.Bisque
    Return editorStyle
End Function

備註

方法 CreateEditorPartChromeStyleStyle 建立 物件用來 EditorPartChrome 呈現 EditorPart 控制項的 物件。

給繼承者的注意事項

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

適用於