Creating a T node and attaching it to the O:
private void Form1_Load(object sender, System.EventArgs e)
{
Shape tdef = new Shape(
Shapes.Ellipse.Outline,
Shapes.Decision.Outline,
null,
FillMode.Winding, "T");
ShapeNode o = CreateONode(100, 40, 150, 80, "CA00: PIZZERIA");
CreateTNode(85, 55, 30, 30, "T01", "completion").AttachTo(o, AttachToNode.TopLeft);
}
ShapeNode CreateTNode(float x, float y, float w, float h, string name, string labelText)
{
ShapeNode t = diagram.Factory.CreateShapeNode(x, y, w, h, Shape.FromId("T"));
t.Brush = new SolidBrush(Color.White);
t.Pen = new Pen(Color.Red, 0.5f);
t.Text = name;
t.Font = new Font("Arial", 15f);
ShapeNode label = diagram.Factory.CreateShapeNode(x, y + h, w, 10);
label.AttachTo(t, AttachToNode.TopCenter);
label.Text = labelText;
label.TextFormat.LineAlignment = StringAlignment.Center;
label.Transparent = true;
label.Locked = true;
return t;
}
Now if you move the O node, T follows it.