AD
Administrator
Syncfusion Team
March 12, 2009 06:21 AM UTC
Hi Rod,
Sorry for the delay in response. Please check the code snippet given below which uses the grouping concept to achieve you requirement and it does not allow the node in a group to be placed away from its bounds.
private RectangleF groupBound;
private bool flagOnce;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
flagOnce = true;
this.DiagramWebControl1.Model.EventSink.PinPointChanged += new PinPointChangedEventHandler(EventSink_PinPointChanged);
Group boundGroup = new Group();
for (int nodeCount = 1; nodeCount < 5; nodeCount++)
{
sRectange rectangle = new sRectange(100, nodeCount * 50, 100, 25);
rectangle.Name = "Node" + nodeCount.ToString();
this.DiagramWebControl1.Model.AppendChild(rectangle);
}
boundGroup.ShowResizeHandles();
this.DiagramWebControl1.Model.AppendChild(boundGroup);
groupBound = boundGroup.BoundingRectangle;
}
}
void EventSink_PinPointChanged(PinPointChangedEventArgs evtArgs)
{
Node node = (Node)evtArgs.NodeAffected;
if (!(groupBound.IntersectsWith(node.BoundingRectangle)))
{
if (flagOnce)
{
flagOnce = false;
node.PinPoint = new PointF(node.PinPoint.X - evtArgs.Offset.Width, node.PinPoint.Y - evtArgs.Offset.Height);
}
}
}
Please let me know if there is any concerns in this regard.
Regards,
Dinesh