Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Tri-arrow (Read 2010 times)
p.hannah
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 38
Joined: Feb 1st, 2006
Tri-arrow
Feb 14th, 2006 at 2:52am
Print Post  
I'm trying to create an arrow that looks like the following:

o
  \
   \
    \                                  o
     x---------                    /
                |                   /
                |                  /
                ------------>x

So, basically I want a normal Cascading arrow with a single polyline at either end.  Above the x's are the connection between cascading and polyline, and the o's are the origin and destination boxes respectively.

Thoughts I've had are to create three arrows and programmatically force the connection points between arrows, and handle selection and manipulation so that the user has the correct experience.  But this seems like a lot of effort (that I'd prefer not to get into Smiley )

So I'm wondering if anyone has any insights that might make it a lot simpler?

Thanks heaps in advance!
Paul.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tri-arrow
Reply #1 - Feb 14th, 2006 at 6:19am
Print Post  
This forum software does not handle ASCII art very well, but with some efforts we've deciphered it to this:



One way to do that is using a single custom-drawn cascading arrow that has 5 segments. The DrawArrow event should calculate the position of the 'x' points based on the coordinates of the other control points and draw sevaral lines - from o1 to x1, then through the next two control points, then to x2 and o2.

Another way to implement something similar is using 3 arrows and intermediate boxes as done in the 'Ternary links' sample coming with the control.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tri-arrow
Reply #2 - Feb 14th, 2006 at 6:50am
Print Post  
Here's what the DrawArrow event handler could look like:

Code
Select All
private void fc_DrawArrow(object sender, MindFusion.FlowChartX.ArrowDrawArgs e)
{
  // assuming there are exactly 5 segments
  PointF cp0 = e.Arrow.ControlPoints[0];
  PointF cp1 = e.Arrow.ControlPoints[1];
  PointF cp2 = e.Arrow.ControlPoints[2];
  PointF cp3 = e.Arrow.ControlPoints[3];
  PointF cp4 = e.Arrow.ControlPoints[4];
  PointF cp5 = e.Arrow.ControlPoints[5];

  PointF xp1 = new PointF(0, 0);
  PointF xp2 = new PointF(0, 0);
  if (cp0.X == cp1.X)
  {
    xp1 = new PointF((cp0.X + cp2.X) / 2, cp2.Y);
    xp2 = new PointF((cp5.X + cp3.X) / 2, cp3.Y);
  }
  else
  {
    xp1 = new PointF(cp2.X, (cp0.Y + cp2.Y) / 2);
    xp2 = new PointF(cp3.X, (cp5.Y + cp3.Y) / 2);
  }

  PointF[] points = new PointF[] { cp0, xp1, cp2, cp3, xp2, cp5 };

  System.Drawing.Pen pen = new System.Drawing.Pen(Color.Black, 0);
  e.Graphics.DrawLines(pen, points);
  pen.Dispose();
}
 



The control point handles would still be displayed at their original coordinates, i.e. the seconds and the next-to-last handles won't lie on the arrow.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint