Exemplo n.º 1
0
        public static List <RadDiagramShape> CreateDivisionBranch(this RadDiagram diagram, string name)
        {
            var shapes   = new List <RadDiagramShape>();
            var director = diagram.CreateShape(name + " director");

            shapes.Add(director);
            var manCount = Rand.Next(2, 4);

            for (var j = 0; j < manCount; j++)
            {
                var man = diagram.CreateShape(name + " manager");
                shapes.Add(man);
                man.Geometry   = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape);
                man.Background = new SolidColorBrush(Colors.Brown);
                var devCount = Rand.Next(3, 6);
                diagram.AddConnection(director, man, ConnectorPosition.Bottom, ConnectorPosition.Top);
                for (var k = 0; k < devCount; k++)
                {
                    var dev = diagram.CreateShape("Dev " + k);
                    shapes.Add(dev);
                    dev.Background = new SolidColorBrush(Colors.LightGray);
                    diagram.Connect(man, dev);
                }
            }
            return(shapes);
        }
Exemplo n.º 2
0
        public Form1()
        {
            StyleManager.ApplicationTheme = new Office_SilverTheme();
            InitializeComponent();

            diagram = new RadDiagram()
            {
                Background = System.Windows.Media.Brushes.White, IsBackgroundSurfaceVisible = false
            };
            elementHost1.Child = diagram;
            var s1 = diagram.AddShape(new RadDiagramShape {
                Position = new System.Windows.Point(120, 50)
            });
            var s2 = diagram.AddShape(new RadDiagramShape {
                Position = new System.Windows.Point(320, 50)
            });
            var con = diagram.AddConnection(s1, s2) as RadDiagramConnection;

            con.Content = "Connected";
            con.Stroke  = System.Windows.Media.Brushes.OrangeRed;

            var info = diagram.AddShape(
                "This is not a XAML form, but a Windows Form hosting RadDiagram.",
                ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape),
                new System.Windows.Point(280, 150)) as RadDiagramShape;

            info.Background = System.Windows.Media.Brushes.Transparent;
            info.Stroke     = System.Windows.Media.Brushes.Silver;
        }
Exemplo n.º 3
0
        public static IConnection Connect(this RadDiagram diagram, IShape a, IShape b, string name = null)
        {
            var c = diagram.AddConnection(a, b);

            if (!string.IsNullOrEmpty(name))
            {
                c.Name = name;
            }
            return(c);
        }
        private double AddShape(Point nextPoint, PeFundHirarchy nextLevel, RadDiagramShape sourceShape)
        {
            double          newX          = 0;
            Point           startingPoint = nextPoint;
            RadDiagramShape topLevel      = new RadDiagramShape()
            {
                Position = startingPoint,
                Width    = width,
                Height   = height,
                Content  = nextLevel.Fund.FundName
            };

            topLevel.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape);
            if (nextLevel.Fund.Id == fund.Id)
            {
                topLevel.Foreground = selectedFundForegroundColor;
                topLevel.Background = selectedFundColor;
            }

            diagram.Items.Add(topLevel);

            if (sourceShape != null)
            {
                // create connection between shape 'Toplevel' and 'SourceShape'

                RadDiagramConnection connection = new RadDiagramConnection();

                connection.Source         = sourceShape;
                connection.Target         = topLevel;
                connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline;
                connection.SourceCapType  = Telerik.Windows.Diagrams.Core.CapType.Arrow1;
                connection.TargetCapType  = Telerik.Windows.Diagrams.Core.CapType.None;
                //connection.Content = $"{nextLevel.Fund.FundName} investiert in {sourceShape.Content.ToString()}";

                diagram.AddConnection(connection);
            }

            startingPoint.Y += displacementY;

            foreach (PeFundHirarchy level in nextLevel.Feeder)
            {
                newX             = AddShape(startingPoint, level, topLevel);
                startingPoint.X += displacementX;
            }

            return(startingPoint.X);
        }
Exemplo n.º 5
0
        public Form1()
        {
            StyleManager.ApplicationTheme = new Office_SilverTheme();
            InitializeComponent();

            diagram = new RadDiagram() { Background = System.Windows.Media.Brushes.White, IsBackgroundSurfaceVisible = false };
            elementHost1.Child = diagram;
            var s1 = diagram.AddShape(new RadDiagramShape { Position = new System.Windows.Point(120, 50) });
            var s2 = diagram.AddShape(new RadDiagramShape { Position = new System.Windows.Point(320, 50) });
            var con = diagram.AddConnection(s1, s2) as RadDiagramConnection;
            con.Content = "Connected";
            con.Stroke = System.Windows.Media.Brushes.OrangeRed;

            var info = diagram.AddShape(
                "This is not a XAML form, but a Windows Form hosting RadDiagram.",
                ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape),
                new System.Windows.Point(280, 150)) as RadDiagramShape;
            info.Background = System.Windows.Media.Brushes.Transparent;
            info.Stroke = System.Windows.Media.Brushes.Silver;
        }