ShapeElement.InitializeResources Method

Initializes the resources for the shape.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll)

protected virtual void InitializeResources(
	StyleSet classStyleSet
)

Parameters

classStyleSet
Type: Microsoft.VisualStudio.Modeling.Diagrams.StyleSet

The class style set for the shape.

This method is called after the class style set has been initialized. You can override this method to add or modify resources for the shape.

This method is called once for the class. It is not called for each instance.

protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
{
base.InitializeResources(classStyleSet);

// Fill brush settings for this shape.
DslDiagrams::BrushSettings backgroundBrush = new DslDiagrams::BrushSettings();
backgroundBrush.Color = global::System.Drawing.Color.FromKnownColor(global::System.Drawing.KnownColor.Blue);
classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.DiagramBackground, backgroundBrush);

// Text brush settings for this shape.
DslDiagrams::BrushSettings textBrush = new DslDiagrams::BrushSettings();
textBrush.Color = global::System.Drawing.Color.FromKnownColor(global::System.Drawing.KnownColor.Red);
classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.DiagramText, textBrush);

}

Community Additions

ADD
Show: