Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic After moving box,I can't delete arrow. (Read 1577 times)
Link
Guest


After moving box,I can't delete arrow.
Feb 4th, 2006 at 1:41am
Print Post  
after moving boxes, the arrows look very mess.
So I wanta delete those arrows to repaint them.

1.box.move()

2. foreach(Arrow a in fc.Arrows)
{
     fc.DeleteObject(a);
}

but there is a System.InvalidOperationException happend "foreach(Arrow a in fc.Arrows)".

I don't know how to resolve it.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: After moving box,I can't delete arrow.
Reply #1 - Feb 4th, 2006 at 8:54am
Print Post  
In .NET you cannot remove an object from a collection while the collection is being enumerated with 'foreach'. DeleteObject removes the arrow from the Arrows collection at some point.

Instead of deleting the box' arrows, why not use arrows of type Dynamic so they update their position? Or after moving the box, call "a.Route()" for the affected arrows ? Calling Route would create better results with 'cascading' arrows; for 'polyline' arrows try the Dynamic property.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint