Exemplo n.º 1
0
        public static void SetBackgroundGradient(
            StyleSet classStyleSet,
            Color backgroundGradientColor, 
            Color backgroundSelectedGradientColor, 
            Color backgroundSelectedInactiveGradientColor,
            Diagram diagram,
            string surfaceTitle)
        {
            #region Set background gradient style and shape attributes

            // 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 = diagram.FindShapeField("Background") as AreaField;
            if (background != null)
            {
                background.DefaultReflectParentSelectedState = true;
                //background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, diagram.MaximumSize.Height / 2);
            }

            #endregion

            #region Set Diagram font and text attributes

            // 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 = surfaceTitle;
            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);

            diagram.ShapeFields.Add(textField);

            #endregion
        }
Exemplo n.º 2
0
        public static void SetBackgroundGradient(
            StyleSet classStyleSet,
            Color backgroundGradientColor,
            Color backgroundSelectedGradientColor,
            Color backgroundSelectedInactiveGradientColor,
            Diagram diagram,
            string surfaceTitle)
        {
            #region Set background gradient style and shape attributes

            // 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 = diagram.FindShapeField("Background") as AreaField;
            if (background != null)
            {
                background.DefaultReflectParentSelectedState = true;
                //background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, diagram.MaximumSize.Height / 2);
            }

            #endregion

            #region Set Diagram font and text attributes

            // 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       = surfaceTitle;
            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);

            diagram.ShapeFields.Add(textField);

            #endregion
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the resources for all fields of this type.
 /// </summary>
 public static void InitializeInstanceResources(StyleSet classStyleSet, float fontSize, Color fontColor)
 {
     FontSettings fontSettings = new FontSettings();
     fontSettings.Style = FontStyle.Bold;
     fontSettings.Size = fontSize;
     classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings);
     BrushSettings brushSettings = new BrushSettings();
     brushSettings.Color = fontColor;
     classStyleSet.OverrideBrush(DiagramBrushes.ShapeText, brushSettings);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes the resources for all fields of this type.
        /// </summary>
        public static void InitializeInstanceResources(StyleSet classStyleSet, float fontSize, Color fontColor)
        {
            FontSettings fontSettings = new FontSettings();

            fontSettings.Style = FontStyle.Bold;
            fontSettings.Size  = fontSize;
            classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings);
            BrushSettings brushSettings = new BrushSettings();

            brushSettings.Color = fontColor;
            classStyleSet.OverrideBrush(DiagramBrushes.ShapeText, brushSettings);
        }