Udostępnij przez


EditorPartChrome.CreateEditorPartChromeStyle Metoda

Definicja

Tworzy obiekt stylu, który dostarcza atrybuty stylu dla każdej EditorPart kontrolki renderowanej przez EditorPartChrome obiekt.

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

Parametry

editorPart
EditorPart

Kontrolka, która jest obecnie renderowana.

chromeType
PartChromeType

Typ chromu dla określonej kontrolki; PartChromeType jedna z wartości wyliczenia.

Zwraca

Element Style zawierający atrybuty stylu dla .editorPart

Wyjątki

Kontrolka, która editorPart odwołuje się do , to null.

Przykłady

W poniższym przykładzie kodu pokazano, jak zastąpić metodę CreateEditorPartChromeStyle , aby zmienić kolor tła kontrolki części edytora. Pełny kod wymagany do uruchomienia przykładu, w tym strona internetowa do hostowania tych kontrolek, można znaleźć w sekcji Przykład w przeglądzie EditorPartChrome klasy.

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

Uwagi

Metoda CreateEditorPartChromeStyle tworzy Style obiekt, który jest używany przez EditorPartChrome obiekt do renderowania kontrolki EditorPart .

Uwagi dotyczące dziedziczenia

Jeśli dziedziczysz z EditorPartChrome klasy, możesz opcjonalnie zastąpić metodę CreateEditorPartChromeStyle(EditorPart, PartChromeType) i scalić informacje o stylu z metody podstawowej z atrybutami stylu niestandardowego, które chcesz dodać. Aby zapoznać się z pokazem, zobacz sekcję Przykład.

Dotyczy