I am trying to create connector symbols like in visio. I have created those connectors by using Graphics.Drawline
method. But I don't know how to make bends to smooth curves like in Microsoft visio.
Code:
protected override void Render(Graphics gfx)
{
PointF[] pts = GetPathPoints();
gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
float x = (float)((pts[0].X + pts[1].X) / 2 - 5);
float y = 0F;
PointF start = new PointF((float)(pts[0].X), (float)(pts[0].Y));
PointF end = new PointF((float)(pts[1].X), (float)(pts[1].Y));
PointF pt1 = new PointF((float)(start.X), (float)(start.Y-50));
PointF pt2 = new PointF((float)(end.X), (float)(end.Y - 50));
using (Pen pen = this.LineStyle.CreatePen())
{
gfx.DrawLine(pen, start, pt1);
gfx.DrawLine(pen, pt1, pt2);
gfx.DrawLine(pen, pt2, end);
}
}
PLease see the connectors that have smooth bends in the below link: http://en.wikipedia.org/wiki/File:BPMN-CollectVotes.jpg
How can I draw lines with rounded corner lines like in visio?