public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.DiagramView1.Diagram.DefaultShape = Shapes.Rectangle; Factory factory = DiagramView1.Diagram.Factory; // Root shape node ShapeNode n1 = factory.CreateShapeNode(32, 12, 35, 18); n1.EnableStyledText = true; n1.Text = "Executive Director" + "\n" + "<i> George Smith </i>" + "\n" + "<b><color=#009900> President and CEO</color></b>"; // Second shape node ShapeNode n2 = factory.CreateShapeNode(2, 36, 25, 18); n2.EnableStyledText = true; n2.Text = "Administrative services" + "\n" + "<i> Thomas Jones </i>" + "\n" + "<b><color=#009900> Vice President</color></b>"; // ShapeNode n3 = factory.CreateShapeNode(32, 36, 25, 18); n3.EnableStyledText = true; n3.Text = "Information services" + "\n" + "<i> James Miller</i>" + "\n" + "<b><color=#009900> Vice President</color></b>"; // ShapeNode n4 = factory.CreateShapeNode(62, 36, 25, 18); n4.EnableStyledText = true; n4.Text = "Communication" + "\n" + "<i> Ann Brown</i>" + "\n" + "<b><color=#009900> Vice President</color></b>"; // ShapeNode n5 = factory.CreateShapeNode(92, 36, 25, 18); n5.EnableStyledText = true; n5.Text = "Innovation" + "\n" + "<i> Tom Jackson</i>" + "\n" + "<b><color=#009900> Vice President</color></b>"; // ShapeNode n6 = factory.CreateShapeNode(2, 58, 25, 18); n6.EnableStyledText = true; n6.Text = "Personnel management" + "\n" + "<i> Tim Miller</i>" + "\n" + "<b><color=#009900> Manager</color></b>"; // ShapeNode n7 = factory.CreateShapeNode(32, 58, 25, 18); n7.EnableStyledText = true; n7.Text = "Publications" + "\n" + "<i> Alice Cross</i>" + "\n" + "<b><color=#009900> Manager</color></b>"; // ShapeNode n8 = factory.CreateShapeNode(62, 58, 25, 18); n8.EnableStyledText = true; n8.Text = "Multi-media" + "\n" + "<i> Kathy Foster</i>" + "\n" + "<b><color=#009900> Manager</color></b>"; // ShapeNode n9 = factory.CreateShapeNode(92, 58, 25, 18); n9.EnableStyledText = true; n9.Text = "Science" + "\n" + "<i> Mike Roberts</i>" + "\n" + "<b><color=#009900> Manager</color></b>"; // //Draw links between shape nodes DiagramLink d12 = factory.CreateDiagramLink(n1, n2); DiagramLink d13 = factory.CreateDiagramLink(n1, n3); DiagramLink d14 = factory.CreateDiagramLink(n1, n4); DiagramLink d15 = factory.CreateDiagramLink(n1, n5); DiagramLink d26 = factory.CreateDiagramLink(n2, n6); DiagramLink d37 = factory.CreateDiagramLink(n3, n7); DiagramLink d48 = factory.CreateDiagramLink(n4, n8); DiagramLink d59 = factory.CreateDiagramLink(n5, n9); } } } |