//------------------------------------------------------------------------- // maxCharsBeforeWrappingText: Set to 0 for no wrapping. public Node AddNode(int id, string header, string title, string text, int maxCharsBeforeWrappingText, Color colour, Node.NodeShape shape) { if (Nodes.ContainsKey(id) == false) { title = WrapText(title, maxCharsBeforeWrappingText, "CENTER"); text = WrapText(text, maxCharsBeforeWrappingText, "LEFT"); string nodeText = $"<SUP>{header}</SUP><BR ALIGN='CENTER' /><B>{title}</B>"; if (text.Any()) { nodeText = $"{nodeText}<BR ALIGN='CENTER' />{text}"; } Node newNode = new Node( id, $"{nodeText}<br/> ", colour, shape); Nodes.Add(id, newNode); return(newNode); } return(Nodes[id]); }
//------------------------------------------------------------------------- // maxCharsBeforeWrappingText: Set to 0 for no wrapping. public Node AddNode(int id, string title, string text, int maxCharsBeforeWrappingText, Color colour, Node.NodeShape shape) { if (Nodes.ContainsKey(id) == false) { title = WrapText(title, maxCharsBeforeWrappingText, "CENTER"); text = WrapText(text, maxCharsBeforeWrappingText, "LEFT"); // Create new node. Node newNode = new Node( id, title + "<BR ALIGN='CENTER' />" + text, colour, shape); Nodes.Add(id, newNode); return(newNode); } return(Nodes[id]); }