/// <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.Square; 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=1; style.PaddingLeft=1; style.PaddingRight=1; style.PaddingTop=1; 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> public static void InitializeTree(AdvTree tree, ComponentFactory factory) { //tree.RootConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector; //tree.RootConnector.LineWidth=1; //tree.RootConnector.LineColor = SystemColors.ControlText; tree.NodesConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector; tree.NodesConnector.LineWidth=1; tree.NodesConnector.LineColor=SystemColors.ControlText; tree.BackColor = SystemColors.Window; //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 = SystemColors.ControlText; tree.Styles.Add(style); tree.NodeStyle=style; tree.BackgroundStyle.Class = ElementStyleClassKeys.TreeBorderKey; tree.AccessibleRole = AccessibleRole.Outline; }