Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic add segment at bezier arrow (Read 1385 times)
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
add segment at bezier arrow
Mar 9th, 2007 at 8:19am
Print Post  
Hi stoyo.

Yesterday you wrote me that in a bezier arrow i can only add a whole segment.

Now, i ask you  Smiley : How can i save and reset the old control point?
Exist yet a method or i must save control point in a file?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: add segment at bezier arrow
Reply #1 - Mar 9th, 2007 at 10:13am
Print Post  
Hi Alesdario,

You could use the following

Code
Select All
private void insertBezierSegment(Arrow arrow, int segment)
{
	if (arrow.Style != ArrowStyle.Bezier)
		throw new ArgumentException("not a Bezier");

	if (segment > arrow.SegmentCount)
		throw new ArgumentException("invalid segment index");

	PointCollection savedPoints = arrow.ControlPoints.Clone();

	// this resets the coordinates of all existing points
	arrow.SegmentCount++;

	// restore the points of the old segments
	for (int i = 0; i < segment * 4; ++i)
		arrow.ControlPoints[i] = savedPoints[i];
	for (int i = (segment + 1) * 4; i < arrow.ControlPoints.Count; ++i)
		arrow.ControlPoints[i] = savedPoints[i - 3];
}
 



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