Q: Is it possible to host more than one control inside a node?
A: You could create a group of a ShapeNode and few ControlNodes, for example:
ShapeNode container = diagram.Factory.CreateShapeNode(20, 20, 50, 55, Shapes.Rectangle); container.HandlesStyle = HandlesStyle.MoveOnly; ControlNode control1 = new ControlNode(diagramView, new Button()); control1.Bounds = new RectangleF(25, 25, 40, 10); diagram.Nodes.Add(control1);ControlNode control2 = new ControlNode(diagramView, new RichTextBox()); control2.Bounds = new RectangleF(25, 40, 40, 30); diagram.Nodes.Add(control2); control1.AttachTo(container, AttachToNode.TopLeft); control2.AttachTo(container, AttachToNode.TopLeft);
Q: How to use the predefined shape templates?
A: Use the FromId method of the Shape class or the members of the Shapes class. Call the CreateShapeNode method through the Factory property of the Diagram class. Set the Shape property of the new ShapeNode object to one of the predefined shapes:
ShapeNode b1 = diagram1.Factory.CreateShapeNode(5, 52, 20, 30); b1.Shape = Shape.FromId("Decision");
Q: I am adding all my nodes at once (from a database table). Then I link them up by adding all my links (from another database table) with the relevant parent and child nodes. I find that the links don't all connect between the edges of the nodes with some linking to the center of the nodes. Why's that?
A: If two nodes intersect and a link is drawn between them, the link will initially link their centers. Either create the nodes further from each other before linking them, or create the link as Dynamic to have it recalculate its end points while nodes are moved around. You might also explicitly assign end point positions by using the DiagramLink.ControlPoints collection.
Q: Is it possible to set anchorpoints in a table cell?
Rows can have anchorpoints. In addition, the AnchorPoint objects have a Column. This property has effect when an AnchorPattern is assigned to a table row. That lets you define the anchor point positions relatively to the table cells.