Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic want ot custom container node. (Read 1605 times)
Shane
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
want ot custom container node.
Apr 11th, 2009 at 6:34am
Print Post  
hi
  I want to custom the container node such that when I add any node to the container node the added node should be replaced by some point like shape and all its link should be incoming to and outgoing from the container node.as i am new to this so please try to send detailed code also.
thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want ot custom container node.
Reply #1 - Apr 13th, 2009 at 8:51am
Print Post  
You could handle the ContainerChildAdded event like this:

Code
Select All
private void OnContainerChildAdded(object sender, ContainerChildEventArgs e)
{
	Rect r = e.Node.Bounds;
	r.Size = new Size(5, 5);
	e.Node.Bounds = r;

	DiagramLinkCollection outLinks = e.Node.OutgoingLinks.Clone();
	foreach (DiagramLink link in outLinks)
		link.Origin = e.Container;

	DiagramLinkCollection inLinks = e.Node.IncomingLinks.Clone();
	foreach (DiagramLink link in inLinks)
		link.Destination = e.Container;
}
 



You might keep the original nodes connected to a links in a Hashtable associated with the container, for example through its Tag property, and restore the links' Oriign and Destination in a similar manner when ContainerChildRemoved is raised.

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