Hi,
The following code fragment demonstrates how to create a line shape through code and how to use it to connect two 2D shapes:
// Create a shape factory
NBasicShapesFactory factory = new NBasicShapesFactory();
// Create two rectangle shapes
NShape shape1 = factory.CreateShape(BasicShapes.Rectangle);
shape1.Bounds = new NRectangleF(50, 50, 100, 50);
document.ActiveLayer.AddChild(shape1);
NShape shape2 = factory.CreateShape(BasicShapes.Rectangle);
shape2.Bounds = new NRectangleF(250, 50, 100, 50);
document.ActiveLayer.AddChild(shape2);
// Create a line shape to connect them
NLineShape lineShape = new NLineShape();
document.ActiveLayer.AddChild(lineShape);
lineShape.FromShape = shape1;
lineShape.ToShape = shape2;