Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Links are not properly showed. (Read 1679 times)
Shane
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
Links are not properly showed.
Apr 11th, 2009 at 1:09pm
Print Post  
Hi
I m adding nodes to the container group and after that i want that the links should be incoming to the container and outgoing from the container.
but for some links it happens and for some it doesn't happens,b'coz null value is assigned in the links which are not properly.......... i am sending the code for reference.
private void btnGroup_Click(object sender, RoutedEventArgs e)

{


diagram.ContainerCaptionHeight = 0;

ContainerNode containerNode = new ContainerNode(diagram);

containerNode.MinimumSize = diagram.Selection.Nodes.GetAt(0).Bounds.Size;

diagram.Nodes.Add(containerNode);

foreach (DiagramNode selectedNode in diagram.Selection.Nodes)

{




int inLinks = selectedNode.IncomingLinks.Count;


for (int i = 0; i < inLinks; i++)


{



DiagramLink link = selectedNode.IncomingLinks.GetAt(i);



if (link != null)



{



link.Destination = containerNode;



}


}





int outLinks = selectedNode.OutgoingLinks.Count;


for (int i = 0; i < outLinks; i++)


{


DiagramLink link = selectedNode.OutgoingLinks.GetAt(i);


if (link != null)


{



link.Origin = containerNode;


}


}





Size size = selectedNode.Bounds.Size;


size.Height = 10;


size.Width = 10;


Rect rect = new Rect(size);


bool rectModified = true;


selectedNode.SetRect(rect, rectModified);


containerNode.Add(selectedNode);



}

containerNode.Caption = "";

containerNode.Margin = 1.0;

containerNode.Foldable = true;

containerNode.Visible = true;

containerNode.UpdateBounds();

containerNode.AutoShrink = true;

containerNode.Brush = Brushes.Transparent;

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Links are not properly showed.
Reply #1 - Apr 13th, 2009 at 8:55am
Print Post  
Changing a link's Destination will automatically remove/add the link from the IncomingLinks collection of the old/new destination node. So after changing the Destination of the first link, your inLinks variable no longer corresponds to the real number of links in the collection. You could call IncomingLinks.Clone() and loop over the copy of the collection.

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