Cant resize GoRectangle inside GoTextNode


#1

Hi all,
Currently, I’m facing the following problem: I can’t resize the GoRectangle object when I resize the GoTextNode object. Could you help me to solve my problem, please?
My code snippet (in C#) is:
--------------- Start ------------------------
GoRoundedRectangle rect = new GoRoundedRectangle();
rect.Resizable = true;
GoImage image = GetImage();
image.Resizable = true;
GoGroup group= new GoGroup();
group.Add(rect);
group.Add(image);
group.Resizable = true;
// Create a GoTextNode
GoTextNode oGoTextNode = new GoTextNode();
oGoTextNode.Resizable = true;
oGoTextNode.Selectable = true;
oGoTextNode.Editable = true;
oGoTextNode.Background = group // Set the back ground of oGoTextNode to be group
--------------------- END ------------------------
Thank you a lot!


#2

Did you want the user to be able to resize the group containing the rectangle and image? Did you try setting GoTextNode.AutoResizes to false? The default value is true, which causes the Background’s Size to automatically fit around the Label (plus the margins). When AutoResizes is false, and the node is Resizable, users should be able to resize the background independent of the Label’s size.
You’ve made each object Selectable (the default), which is probably not what you intend. Unless you really mean for users to be able to select the image independently of the rounded rectangle and independently of the group of both, I recommend you make all of those objects, including the group, not Selectable. You probably don’t need to make the image and rounded rectangle Resizable either, as long as the group is Resizable.


#3

I tried to update my code to follow your solution, but it didn’t give me any results.


#4

I just tried this, and it seems to work fine:
GoTextNode tnt = new GoTextNode();
tnt.Text = “Hello again. This first line has a lot of text and should wrap.”;
tnt.Label.Alignment = GoObject.Middle;
tnt.Label.StringTrimming = StringTrimming.EllipsisWord;
tnt.AutoResizes = false;
tnt.Resizable = true;
tnt.ResizesRealtime = true;
GoRoundedRectangle rrect = new GoRoundedRectangle();
rrect.Selectable = false;
rrect.Bounds = new RectangleF(700, 300, 100, 50);
GoImage image = new GoImage();
image.Name = “star.gif”;
image.Selectable = false;
image.SetSpotLocation(GoObject.MiddleTop, rrect, GoObject.MiddleTop);
GoGroup group= new GoGroup();
group.Selectable = false;
group.Add(rrect);
group.Add(image);
tnt.Background = group;
tnt.TopLeftMargin = new SizeF(tnt.TopLeftMargin.Width, image.Height);
doc.Add(tnt);
If you want better control over the size and/or position of the image, you will need to override GoGroup.LayoutChildren so that you can do what you want.


#5

Thank you a lot