示例#1
0
 public GroupNodeStyle()
 {
     delegateStyle  = new CollapsibleNodeStyleDecorator();
     ButtonLocation = ButtonLocation.TopLeft;
     Inset          = 5;
     Wrapped        = new PanelNodeStyle();
 }
        /// <summary>
        /// Called upon loading of the form.
        /// This method initializes the graph and the input mode.
        /// </summary>
        /// <seealso cref="ConfigureBridges"/>
        /// <seealso cref="InitializeGraph"/>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            description.LoadFile(new MemoryStream(Resources.description), RichTextBoxStreamType.RichText);

            graphControl.Graph.NodeDefaults.Style = new BevelNodeStyle {
                Color = Color.Orange
            };
            PanelNodeStyle style = new PanelNodeStyle {
                Color = Color.LightBlue, Insets = new InsetsD(20, 40, 20, 20)
            };

            graphControl.Graph.GroupNodeDefaults.Style = style;

            //Draw edges in front, so that group nodes don't hide the bridges...
            graphControl.GraphModelManager.EdgeGroup.ToFront();
            graphControl.GraphModelManager.HierarchicNestingPolicy = HierarchicNestingPolicy.Nodes;

            InitializeGraph(graphControl.Graph);

            ConfigureBridges();

            graphControl.InputMode = new GraphEditorInputMode {
                AllowGroupingOperations = true
            };
        }
示例#3
0
        /// <summary>
        /// Change the default style for group nodes.
        /// </summary>
        /// <remarks>We use <see cref="CollapsibleNodeStyleDecorator"/> to wrap the
        /// <see cref="PanelNodeStyle"/> from the last demo, since we want to have nice
        /// +/- buttons for collapse/expand. Note that if you haven't defined
        /// a custom group node style, you don't have to do anything at all, since
        /// <see cref="FoldingManager"/> already
        /// provides such a decorated group node style by default.</remarks>
        private void WrapGroupNodeStyles()
        {
            //PanelNodeStyle is a nice style especially suited for group nodes
            PanelNodeStyle style = new PanelNodeStyle {
                Color = Color.LightBlue
            };

            //Wrap the style with CollapsibleNodeStyleDecorator
            graphControl.Graph.GroupNodeDefaults.Style = new CollapsibleNodeStyleDecorator(style);
        }
        /// <summary>
        /// Change the default style for group nodes.
        /// </summary>
        /// <remarks>We use <see cref="CollapsibleNodeStyleDecorator"/> to wrap the
        /// <see cref="PanelNodeStyle"/> from the last demo, since we want to have nice
        /// +/- buttons for collapse/expand. Note that if you haven't defined
        /// a custom group node style, you don't have to do anything at all, since
        /// <see cref="FoldingManager"/> already
        /// provides such a decorated group node style by default.</remarks>
        private void WrapGroupNodeStyles()
        {
            IFoldingView foldingView = graphControl.Graph.GetFoldingView();

            if (foldingView != null)
            {
                //PanelNodeStyle is a nice style especially suited for group nodes
                PanelNodeStyle style = new PanelNodeStyle {
                    Color = Colors.LightBlue
                };

                //Wrap the style with CollapsibleNodeStyleDecorator
                foldingView.Graph.GroupNodeDefaults.Style = new CollapsibleNodeStyleDecorator(style);
            }
        }
示例#5
0
        /// <summary>
        /// Creates a small graph and various layouts to it.
        /// </summary>
        private void InitializeGraph()
        {
            IGraph graph = graphControl.Graph;

            graphControl.FileOperationsEnabled     = true;
            graphControl.NavigationCommandsEnabled = true;
            //Create graph
            graph.NodeDefaults.Size = new SizeD(50, 30);

            // set the style as the default for all new nodes
            graph.NodeDefaults.Style = graph.NodeDefaults.Style = new BevelNodeStyle
            {
                Color  = Color.FromArgb(0xFF, 0xFF, 0x8C, 0x00),
                Inset  = 2,
                Radius = 5,
            };

            // set the style as the default for all new edges
            graph.EdgeDefaults.Style = new PolylineEdgeStyle {
                TargetArrow = Arrows.Default
            };

            // set the style as the default for all new node labels
            graph.NodeDefaults.Labels.Style = new DefaultLabelStyle();
            PanelNodeStyle groupNodeStyle = new PanelNodeStyle
            {
                Color            = Color.FromArgb(255, 135, 206, 250),
                LabelInsetsColor = Color.FromArgb(255, 173, 216, 230),
                Insets           = new InsetsD(10, 10, 10, 20)
            };

            graph.GroupNodeDefaults.Style = groupNodeStyle;

            ReadSampleGraph();

            // enable undo...
            graph.SetUndoEngineEnabled(true);
        }
        /// <summary>
        /// Called upon loading of the form.
        /// This method initializes the graph and the input mode.
        /// </summary>
        /// <seealso cref="ConfigureBridges"/>
        /// <seealso cref="InitializeGraph"/>
        protected virtual void OnLoad(object src, EventArgs e)
        {
            graphControl.Graph.NodeDefaults.Style = new BevelNodeStyle {
                Color = Colors.Orange
            };
            PanelNodeStyle style = new PanelNodeStyle {
                Color = Colors.LightBlue, Insets = new InsetsD(20, 40, 20, 20)
            };

            graphControl.Graph.GroupNodeDefaults.Style = style;

            //Draw edges in front, so that group nodes don't hide the bridges...
            graphControl.GraphModelManager.EdgeGroup.ToFront();
            graphControl.GraphModelManager.HierarchicNestingPolicy = HierarchicNestingPolicy.Nodes;

            InitializeGraph(graphControl.Graph);

            ConfigureBridges();

            graphControl.InputMode = new GraphEditorInputMode {
                AllowGroupingOperations = true
            };
        }