当前位置: 首页>>代码示例>>C#>>正文


C# Diagram.FindShapeField方法代码示例

本文整理汇总了C#中Diagram.FindShapeField方法的典型用法代码示例。如果您正苦于以下问题:C# Diagram.FindShapeField方法的具体用法?C# Diagram.FindShapeField怎么用?C# Diagram.FindShapeField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Diagram的用法示例。


在下文中一共展示了Diagram.FindShapeField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetBackgroundGradient

        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
        }
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:56,代码来源:DiagramUtility.cs


注:本文中的Diagram.FindShapeField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。