We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add horizontal line to a grid

hi,
How do I add a horizontal line to a WODiagram grid. This horizontal line should move down automatically when i add any kind of block above the line. I am using C#. Kindly help me out with this.

Thank you


1 Reply

PM Pandi Murugan A Syncfusion Team November 29, 2010 07:39 AM UTC

Hi Rohit,

Thanks for using Syncfusion products.

We suggest you to change the PinPoint of Line based on bounding rectangle of the block(node)which is added to the diagram. Please refer the below code snippet.

[C#]

//Node Collection Changed event

void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
if (evtArgs.Element != null)
{

Node node = (Node)evtArgs.Element;
//Get the Line
Node lineNode = diagram1.Model.GetChildByName("MyLine");
//Check the BoundingRectangle's of Line and Node(Block)
if (lineNode.BoundingRectangle.Top < node.BoundingRectangle.Bottom)
{
//Change the PinPoint of Line
lineNode.PinPoint = new PointF(lineNode.PinPoint.X,node.BoundingRectangle.Bottom + 20);
}
}
}
}


For your convenience, we have created a simple sample to demonstrate this and the same can be downloaded from the below link.

FSample-776916365.zip

Kindly try the above sample and let me know if this helps.

Regards,
Pandi Murugan A



Loader.
Live Chat Icon For mobile
Up arrow icon