GoTextNode with AutoResize + minimun size

I’d like to have a circle gotextnode with a minimum size that automatically resize to contain the text inside.
Is it possible to have a GoTextNode or a derived object with autoresizes = true but with a minimum height and/or width?
and what about a maximum height and/or width?
and what about a fixed aspect ratio?

Sure, just override LayoutChildren and have it set the Shape’s Bounds to whatever you want, relative to the Bounds of the Label.

What do you mean with Shape’s bounds and relative to the Bunds of the Label?
I tried to set the width and height of the background but the Label goes weird.
If I try to set the GoTextNode Width and Height I generate an endless loop and an overflow error…
Please some more help…

This doesn’t maintain a particular aspect ratio, but you could implement that where newwidth and newheight are calculated:
[Serializable]
public class LimitedTextNode : GoTextNode {
public LimitedTextNode() {
this.Label.StringTrimming = StringTrimming.EllipsisCharacter;
}
protected override GoObject CreateBackground() {
GoEllipse e = new GoEllipse();
e.Selectable = false;
e.Resizable = false;
return e;
}
public override void LayoutChildren(GoObject childchanged) {
if (this.Initializing) return;
GoText label = this.Label;
if (label == null) return;
GoObject back = this.Background;
if (back != null) {
SizeF topleft = this.TopLeftMargin;
SizeF bottomright = this.BottomRightMargin;
float newwidth = label.Width + topleft.Width + bottomright.Width;
if (newwidth < 100) newwidth = 100;
else if (newwidth > 500) newwidth = 500;
float newheight = label.Height + topleft.Height + bottomright.Height;
if (newheight < 50) newheight = 50;
else if (newheight > 250) newheight = 250;
back.Bounds = new RectangleF(label.Center.X - newwidth/2, label.Center.Y - newheight/2, newwidth, newheight);
// you might want to limit the size of the Label too
}
if (back != null) {
if (this.TopPort != null)
this.TopPort.SetSpotLocation(MiddleTop, back, MiddleTop);
if (this.RightPort != null)
this.RightPort.SetSpotLocation(MiddleRight, back, MiddleRight);
if (this.BottomPort != null)
this.BottomPort.SetSpotLocation(MiddleBottom, back, MiddleBottom);
if (this.LeftPort != null)
this.LeftPort.SetSpotLocation(MiddleLeft, back, MiddleLeft);
}
}
}