I want the font of the text in a GoBasicNode to change as I resize the object. AFAIK this property is available only for a GoText object. Is there some way to grow ports on a GoText object?
If not, my solution will be to derive a GoGroup class that has two children superimposed at the same location - a GoBasicNode for the node flavor and a GoText for the resizable font. Does this kludge sound workable?
[Serializable] public class ResizableBasicNode : GoBasicNode { public ResizableBasicNode() { this.Text = “”; // to create a Label this.Label.AutoRescales = true; this.LabelSpot = GoObject.Middle; // before setting Resizable this.Resizable = true; this.Reshapable = false; } public override GoObject SelectionObject { get { return this; } // so resizing resizes whole node, not just the Shape } public override void LayoutChildren(GoObject childchanged) { base.LayoutChildren(childchanged); if (this.Label != null && this.Shape != null) { this.Label.Center = this.Shape.Center; } } }
As for your proposed alternative, that sounds pretty good, except that since you want it to act like an IGoNode, you should have it inherit from GoNode instead of GoGroup. But I don’t think you need that alternative, if you find the above definition good enough for your purposes.