/// <summary> /// Creates new style and adds it to styles collection /// </summary> /// <param name="tree">Tree to assign style to</param> /// <param name="factory">Style factory</param> /// <param name="backColor"></param> /// <param name="backColor2"></param> /// <param name="gradientAngle"></param> /// <param name="textColor"></param> internal static ElementStyle CreateStyle(ComponentFactory factory, string description, Color borderColor, Color backColor, Color backColor2, int gradientAngle, Color textColor) { eStyleBorderType border=eStyleBorderType.Solid; ElementStyle style=factory.CreateComponent(typeof(ElementStyle)) as ElementStyle; style.Description = description; style.BackColor = backColor; style.BackColor2=backColor2; style.BackColorGradientAngle=gradientAngle; style.CornerDiameter=4; style.CornerType=eCornerType.Rounded; style.BorderLeft=border; style.BorderLeftWidth=1; style.BorderTop=border; style.BorderTopWidth=1; style.BorderBottom=border; style.BorderBottomWidth=1; style.BorderRight=border; style.BorderRightWidth=1; style.BorderColor=borderColor; style.PaddingBottom=3; style.PaddingLeft=3; style.PaddingRight=3; style.PaddingTop=3; style.TextColor=textColor; return style; }
/// <summary> /// Initializes control with default settings for connectors and nodes. /// </summary> /// <param name="tree">Control to initialize.</param> /// <param name="factory">Factory to use to create new instances of objects.</param> internal static void InitializeTree(TreeGX tree, ComponentFactory factory) { tree.RootConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector; tree.RootConnector.LineWidth=5; tree.RootConnector.LineColor=SystemColors.Highlight; tree.NodesConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector; tree.NodesConnector.LineWidth=5; tree.NodesConnector.LineColor=SystemColors.Highlight; eStyleBorderType border=eStyleBorderType.Solid; ElementStyle style=factory.CreateComponent(typeof(ElementStyle)) as ElementStyle; style.BackColorSchemePart=eColorSchemePart.BarBackground; style.BackColor2SchemePart=eColorSchemePart.BarBackground2; style.BackColorGradientAngle=90; style.CornerDiameter=4; style.CornerType=eCornerType.Rounded; style.BorderLeft=border; style.BorderLeftWidth=1; style.BorderTop=border; style.BorderTopWidth=1; style.BorderBottom=border; style.BorderBottomWidth=1; style.BorderRight=border; style.BorderRightWidth=1; style.BorderColorSchemePart=eColorSchemePart.BarDockedBorder; style.PaddingBottom=3; style.PaddingLeft=3; style.PaddingRight=3; style.PaddingTop=3; style.TextColor=Color.FromArgb(0,0,128); style.Font=tree.Font; tree.Styles.Add(style); tree.NodeStyle=style; }