Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How can I secah node? (Read 2192 times)
lpastor
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jan 10th, 2009
How can I secah node?
Jan 11th, 2009 at 6:54pm
Print Post  
I have more than one node in diagram .
I whant to remove all node except one.

1 case is to remove all except one that I click on
2 case is to remove any node with name "123"


also I have a problem with remove Item or Remove node ... don't work
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I secah node?
Reply #1 - Jan 12th, 2009 at 6:06am
Print Post  
Remove should work in this version:
https://mindfusion.eu/_beta/DiagramLite.0.9.3.zip

You cannot remove items from a collection while iterating over the collection, so you will have to use a second collection and loop:

Code
Select All
DiagramNodeCollection toRemove = new DiagramNodeCollection();
foreach (ShapeNode node is diagram.Nodes)
{
	if (!node.Selected)
		toRemove.Add(node);
	if (node.Text == "123")
		toRemove.Add(node);
}
foreach (DiagramNode node is toRemove)
{
	diagram.Items.Remove(node);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint