Exemple #1
0
        public static Rectangle getRect(Nodes.Node n) {
            int titleWidth = System.Windows.Forms.TextRenderer.MeasureText(n.getName(), nodeTitleFont).Width;
            Rectangle nodeRect = new Rectangle();
            nodeRect.Location = n.getPos();
            nodeRect.Width = Math.Max(100, titleWidth);
            nodeRect.Height = nodeTitleFont.Height;

            //count the lines to cover with text
            if (n.getExtra() != null && n.getExtra() != "") {
                nodeRect.Height += nodeExtraFont.Height;
            }
            foreach (var kvp in n.getProperties()) {
                if (kvp.Value.isInput || kvp.Value.isOutput) {
                    nodeRect.Height += nodeFont.Height;
                }
            }
            return nodeRect;
        }