Exemple #1
0
        public override GraphicsPath Render(Graphics g, Rectangle r, NodeStyle o)
        {
            var leftRect  = new Rectangle(r.X, r.Y, r.Height, r.Height);
            var rightRect = new Rectangle(r.Right - r.Height, r.Y, r.Height, r.Height);
            var path      = new GraphicsPath();

            path.StartFigure();
            path.AddArc(leftRect, 90, 180);
            path.AddArc(rightRect, -90, 180);
            path.CloseFigure();
            //
            g.FillPath(o.BackBrush, path);
            g.DrawPath(o.BorderPen, path);
            return(path);
        }
Exemple #2
0
        public override GraphicsPath Render(Graphics g, Rectangle r, NodeStyle o)
        {
            var path = new GraphicsPath();

            path.StartFigure();
            path.AddPolygon(new Point[]
            {
                r.CenterTop(),
                r.CenterRight(),
                r.CenterBottom(),
                r.CenterLeft()
            });
            path.CloseFigure();
            //
            g.FillPath(o.BackBrush, path);
            g.DrawPath(o.BorderPen, path);
            return(path);
        }
Exemple #3
0
        public override GraphicsPath Render(Graphics g, Rect r, NodeStyle o)
        {
            var path = new GraphicsPath();

            path.StartFigure();
            path.AddPolygon(new Point[]
            {
                new Point(r.X + PageRenderOptions.GridSize, r.Y),
                new Point(r.Right, r.Y),
                new Point(r.Right - PageRenderOptions.GridSize, r.Bottom),
                new Point(r.X, r.Bottom),
            });
            path.CloseFigure();
            //
            g.FillPath(o.BackBrush, path);
            g.DrawPath(o.BorderPen, path);
            return(path);
        }
Exemple #4
0
 private void RenderPorts(Graphics g)
 {
     if (this.MoveNodeOffsetPoint == Point.Empty)
     {
         var o = new NodeStyle();
         foreach (var node in this.SelectedNodes)
         {
             node.RenderedPorts.Clear();
             var nodePath = this.RenderedNodes[node];
             foreach (var port in node.Ports)
             {
                 var portPath = port.Render(g, node.Bounds, o);
                 node.RenderedPorts.Add(port, portPath);
                 nodePath.FillMode = FillMode.Winding;
                 nodePath.AddPath(portPath, false);
             }
         }
     }
 }
Exemple #5
0
        private void RenderLines(Graphics g)
        {
            var o = new NodeStyle();
            var f = new PathFinder(this.Nodes);

            foreach (var node in this.Nodes)
            {
                foreach (var port in node.Ports)
                {
                    o.LinePenWithArrow.Brush = port.GetBackBrush();
                    if (this.LinkNodeEndPoint != Point.Empty && this.LinkNodeStartPort == port)
                    {
                        g.DrawLine(o.LinePenWithArrow, port.Bounds.Center().X, port.Bounds.Center().Y, this.LinkNodeEndPoint.X, this.LinkNodeEndPoint.Y);
                    }
                    else if (this.GetNodeById(port.NextNodeId) is Node linkedNode)
                    {
                        g.DrawPath(o.LinePenWithArrow, f.GetPath(port.Bounds.Center(), linkedNode.Bounds.CenterTop()));
                    }
                }
            }
        }
Exemple #6
0
 public void RenderText(Graphics g, Rectangle r, NodeStyle o)
 {
     g.DrawString(this.Name, o.Font, o.FontBrush, r, o.StringFormat);
 }
Exemple #7
0
 public abstract GraphicsPath Render(Graphics g, Rectangle r, NodeStyle o);
Exemple #8
0
 public override void RenderText(Graphics g, Rect r, NodeStyle o)
 {
     g.DrawString(this.Name + Environment.NewLine + this.CurrentValue, o.Font, o.FontBrush, r, o.StringFormat);
 }