|
// This method runs per model
protected override void InitializeResources(StyleSet classStyleSet)
{
base.InitializeResources(classStyleSet);
// Fill brush settings for background (Start gradient color).
BrushSettings backgroundBrush = new BrushSettings();
backgroundBrush.Color = BackgroundGradientColor;
classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackground, backgroundBrush);
// Selected state
backgroundBrush = new BrushSettings();
backgroundBrush.Color = BackgroundSelectedGradientColor;
classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelected, backgroundBrush);
// SelectedInactive state
backgroundBrush = new BrushSettings();
backgroundBrush.Color = BackgroundSelectedInactiveGradientColor;
classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelectedInactive,
backgroundBrush);
// We should find a "Background" field created when we set the
// HasBackgroundGradient property to "true"
AreaField background = this.FindShapeField("Background") as AreaField;
if (background != null)
{
background.DefaultReflectParentSelectedState = true;
// We can set the height of the background area a bit smaller (like half the
// total height) so the gradient will fade "faster" so you can see the fading in
// samller areas
background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom,
this.MaximumSize.Height / 2);
}
// Custom font styles for diagram title
FontSettings fontSettings;
fontSettings = new FontSettings();
fontSettings.Style = FontStyle.Bold;
fontSettings.Size = 9 / 72.0F;
classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings);
// Create a text field for the Diagram Title
TextField textField = new TextField("DiagramTitle");
textField.DefaultText = "Itinerary Designer";
textField.DefaultVisibility = true;
textField.DefaultAutoSize = true;
textField.DefaultFontId = DiagramFonts.ShapeTitle;
textField.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.33);
textField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.07);
this.ShapeFields.Add(textField);
} |