语言

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

特定控件的部件版式类型; PartChromeType 枚举值之一。

返回

一个包含样式属性的 StyleAeditorPart。

例外

引用的 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

注解

该方法 CreateEditorPartChromeStyle 创建 Style 对象用于 EditorPartChrome 呈现 EditorPart 控件的对象。

继承者说明

如果继承自 EditorPartChrome 类,可以选择重写 CreateEditorPartChromeStyle(EditorPart, PartChromeType) 该方法,并将基方法中的样式信息与要添加的自定义样式属性合并。 有关演示,请参阅“示例”部分。

适用于