EditorPartChrome.CreateEditorPartChromeStyle Method

Definition

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

C#
protected virtual System.Web.UI.WebControls.Style CreateEditorPartChromeStyle(System.Web.UI.WebControls.WebParts.EditorPart editorPart, System.Web.UI.WebControls.WebParts.PartChromeType chromeType);

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.

C#
protected override Style CreateEditorPartChromeStyle(EditorPart editorPart, PartChromeType chromeType)
{
    Style editorStyle = base.CreateEditorPartChromeStyle(editorPart, chromeType);
    editorStyle.BackColor = Color.Bisque;
    return editorStyle;
}

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

Produit Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1