Nodes list

hello again,
I have drawed the diagram,
now i have to get all the nodes present in it so i can write a for loop that tests if a selected node when droped on any other node in the diagram. if the selected node intersets with that node, an event should be raised. I want to do this on nodes that are created by the users.
i used the sample u provide me for the intersection but it didn't work.
thanks a lot for you help
Sincerly
Elia CHKAYRA

1 Reply

J. J.Nagarajan Syncfusion Team August 31, 2007 12:57 AM UTC

Hi Elia,

Thanks for your continued interest in Syncfusion product.

If your intention is to fire an event when you moved a node on another node in diagram model then you can write your own delegate. Please refer to the following code snippet

public delegate void NodeDragDrop(object sender, PinPointChangedEventArgs evtargs);
public event NodeDragDrop nodedragdrop;

public MainForm()
{
this.nodedragdrop += new NodeDragDrop(MainForm_nodedragdrop);
this.diagram1.Model.EventSink.PinPointChanged += new PinPointChangedEventHandler(EventSink_PinPointChanged);
}

void EventSink_PinPointChanged(PinPointChangedEventArgs evtArgs)
{
Node objNode = evtArgs.NodeAffected as Node;
foreach (INode m_node in this.diagram1.Model.Nodes)
{
Node node = m_node as Node;
if(objNode != node && objNode.BoundingRectangle.IntersectsWith(node.BoundingRectangle))
{
this.nodedragdrop(this, evtArgs);
}
}

}

I have attahced the sample that demonstrates this completely. You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Diagram.Windows/F67796/main.htm

Please refer to the sample and let me know if you ahve any questions.

Regards,
Nagaraj

Loader.
Up arrow icon