public static void UpdateEdge(PPath edge) { // Note that the node's "FullBounds" must be used (instead of just the "Bound") // because the nodes have non-identity transforms which must be included when // determining their position. ArrayList nodes = (ArrayList)edge.Tag; PNode node1 = (PNode)nodes[0]; PNode node2 = (PNode)nodes[1]; PointF start = node1.GlobalBounds.Location; PointF end = node2.GlobalBounds.Location; float h1x, h1y, h2x, h2y; start.X += node1.GlobalBounds.Width * 0.5f; start.Y += node1.GlobalBounds.Height; h1x = h2x = 0; h1y = h2y = end.Y > start.Y ? 200 * (float)Math.Log10((end.Y - start.Y) / 200 + 1) : 200 * (float)Math.Log10((start.Y - end.Y) / 100 + 1); end.X += node2.GlobalBounds.Width / 2; //end.Y += node2.GlobalBounds.Height / 2; edge.Reset(); //edge.AddLine(start.X, start.Y, end.X, end.Y); edge.AddBezier(start.X, start.Y, start.X + h1x, start.Y + h1y, end.X - h2x, end.Y - h2y, end.X, end.Y); }
public static void UpdateEdge(PPath edge) { // Note that the node's "FullBounds" must be used (instead of just the "Bound") // because the nodes have non-identity transforms which must be included when // determining their position. ArrayList nodes = (ArrayList)edge.Tag; PNode node1 = (PNode)nodes[0]; PNode node2 = (PNode)nodes[1]; PointF start = PUtil.CenterOfRectangle(node1.FullBounds); PointF end = PUtil.CenterOfRectangle(node2.FullBounds); edge.Reset(); edge.AddLine(start.X, start.Y, end.X, end.Y); }