Upravit

Sdílet prostřednictvím


EditorPartChrome.CreateEditorPartChromeStyle Method

Definition

Creates the style object that supplies style attributes for each EditorPart control rendered by the EditorPartChrome object.

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

Parameters

editorPart
EditorPart

The control that is currently being rendered.

chromeType
PartChromeType

The type of chrome for a particular control; one of the PartChromeType enumeration values.

Returns

A Style that contains style attributes for editorPart.

Exceptions

The control that editorPart refers to is null.

Examples

The following code example demonstrates how to override the CreateEditorPartChromeStyle method to change the background color of the editor part control. For the full code required to run the example, including the Web page to host these controls, see the Example section of the EditorPartChrome class overview.

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

Remarks

The CreateEditorPartChromeStyle method creates a Style object that is used by the EditorPartChrome object to render an EditorPart control.

Notes to Inheritors

If you inherit from the EditorPartChrome class, you can optionally override the CreateEditorPartChromeStyle(EditorPart, PartChromeType) method, and merge the style information from the base method with custom style attributes that you want to add. For a demonstration, see the Example section.

Applies to