本文整理汇总了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
}