Hi,
Yes, you can accomplish this. Here’s a sample source code:
private NNodeList shapes;
private void CreateDiagram()
{
shapes = new List<NShape>();
NBasicShapesFactory f = new NBasicShapesFactory(document);
f.DefaultSize = new NSizeF(100, 100);
NShape square = f.CreateShape(BasicShapes.Rectangle);
square.Location = new NPointF(0, 0);
document.ActiveLayer.AddChild(square);
NShape circle = f.CreateShape(BasicShapes.Circle);
circle.Location = new NPointF(0, 200);
document.ActiveLayer.AddChild(circle);
document.EventSinkService.NodeBoundsChanged += new NodeEventHandler(EventSinkService_NodeBoundsChanged);
document.SizeToContent();
shapes = document.Descendants(NFilters.Shape2D, -1);
}
private void EventSinkService_NodeBoundsChanged(NNodeEventArgs args)
{
if (args.Node is NShape)
{
NShape draggedShape = (NShape)args.Node;
if (draggedShape.ShapeType == ShapeType.Shape1D)
return;
NRectangleF bounds = draggedShape.Bounds;
bounds = view.SceneToDevice.TransformBounds(bounds);
NHitTestContext hitTestContext = view.ProvideDocumentHitTestContext();
for (int i = 0; i < shapes.Count; i++)
{
NShape shape = (NShape)shapes[i];
if (shape == draggedShape)
continue;
if (shape.HitTest(bounds, hitTestContext))
{
NStyle.SetFillStyle(shape, new NColorFillStyle(KnownArgbColorValue.Red));
}
else
{
shape.Style.FillStyle = null;
}
}
}
}
Best Regards,
Nevron Support Team