EditorPartChrome.CreateEditorPartChromeStyle 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立樣式物件,為物件渲染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
針對特定控制的鍍鉻類型;其中一個 PartChromeType 列舉值。
傳回
Style包含 的editorPart樣式屬性的 A。
例外狀況
所 editorPart 指的控制是 null。
chromeType 不是 PartChromeType。
範例
以下程式碼範例示範如何覆寫 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
備註
此方法會 CreateEditorPartChromeStyle 建立 Style 一個物件,物件用 EditorPartChrome 來渲染控制項 EditorPart 。
給繼承者的注意事項
如果你繼承了 EditorPartChrome 這個類別,你可以選擇覆蓋該方法, CreateEditorPartChromeStyle(EditorPart, PartChromeType) 並將基礎方法的樣式資訊與你想加入的自訂樣式屬性合併。 示範請參見範例部分。