Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Setter of SegmentCount doesnt work, Version 5.0.3 (Read 2134 times)
Luke
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 22nd, 2008
Setter of SegmentCount doesnt work, Version 5.0.3
May 22nd, 2008 at 8:00pm
Print Post  
Hi,
@see subject

// ControlPoints == 3
link.ControlPoints.Clear(); // ControlPoints == 3
link.SegmentCount =(short) (arrayOfPoints.Length - 1); // ControlPoints == 3 , but arrayOfPoints.Length == 7
foreach (Point p in arrayOfPoint)
link.ControlPoints.Add(new PointF(p.x, p.y));
link.UpdateFromPoints();
//ControlPoints == 3

On this account, i cannt (eg) set a calculated path. ->System.ArgumentOutOfRangeException

best regards
Luke
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Setter of SegmentCount doesnt work, Version 5.
Reply #1 - May 23rd, 2008 at 4:23am
Print Post  
Hi,

You cannot set the number of segments if AutoRoute is enabled, so you might have to set AutoRoute = false before the SegmentCount assignment. This also depends on the Style - Bezier links have 3 * SegmentCount + 1 control points. Additionally, the SegmentCount setter automatically sets the number of points, so you must not add new points to the collection. E.g. for polyline and cascading links, you can set the point coordinates like this

link.SegmentCount = (short) (arrayOfPoints.Length - 1);
for (int i = 0; i < arrayOfPoint.Length; ++i)
   link.ControlPoints[i] = arrayOfPoint[i];

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Luke
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 22nd, 2008
Re: Setter of SegmentCount doesnt work, Version 5.
Reply #2 - May 23rd, 2008 at 6:50am
Print Post  
whoa..

link.AutoRoute = false;
link.SegmentCount = (short) (arrayOfPoints.Length - 1);
link.AutoRoute = true;
for (int i = 0; i < arrayOfPoint.Length; ++i) 
   link.ControlPoints[i] = arrayOfPoint[i];

... works, great support, but this should be documented
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint