Resizing a node

Hi,
I have a node which is GoBoxNode extended class object, that contains two textboxes(GoText objects) and an Icon(GoBotton). These are created as child objects of GoGroup object.
If I resize the node with mouse then the text boxes in that node should be resized.
I tried this resie by overriding DoResize() method but the textboxes are not getting resized properly.
So, If anyone have the solution/suggestion pls send it as soon as possible.
This is the Object I have created from GoBoxNode Extended class
It looks like you are using the InfoNode example class from Demo1.
If you set each of the GoText objects AutoRescales = true and make the whole node Resizable and Reshapable, you'll note that everything is rescaled as the node is resized.
But having the GoText objects rescale probably isn't what you want. (That's why the AutoRescales property is set to false by the GoText constructor.) Also, you might not like how the GoButton rescales too.
So instead you need to override the LayoutChildren method, since it is responsible for sizing and positioning all of the child objects of a GoGroup. Here's the modified InfoNode.cs example:
/*
* Copyright © Northwoods Software Corporation, 1998-2007. All Rights
* Reserved.
*
* Restricted Rights: Use, duplication, or disclosure by the U.S.
* Government is subject to restrictions as set forth in subparagraph
* (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR
* 52.227-14 Alt. III, as applicable.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using Northwoods.Go;
namespace Demo1 {
[Serializable]
public class InfoNode : GoBoxNode {
public InfoNode() {
this.Resizable = true;
this.ResizesRealtime = true;
this.PortBorderMargin = new SizeF(0, 0);
this.Port.Brush = Brushes.White;
this.Port.Pen = Pens.Black;
this.LinkPointsSpread = true;
}
public void Initialize() {
GoGroup infog = new GoGroup();
infog.Selectable = false;
GoRectangle infor = new GoRectangle();
infor.Selectable = false;
infor.Brush = Brushes.LightGray;
infog.Add(infor);

GoText infot1 = new GoText();
infot1.Selectable = false;
infot1.AutoResizes = false;
infot1.StringTrimming = StringTrimming.EllipsisWord;
infot1.Text = "Welcome";
infog.Add(infot1);

GoButton infob = new GoButton();
infob.Selectable = false;
infob.AutoRescales = false;
infob.Label = null;
GoImage infoi = new GoImage();
infoi.Name = @"star.gif";
infob.Icon = infoi;
infog.Add(infob);
infob.Action += new GoInputEventHandler(button_Action);
infob.Size = new SizeF(16, 16);
myButton = infob;
GoText infot2 = new GoText();
infot2.Selectable = false;
infot2.Wrapping = true;
infot2.Multiline = true;
infot2.AutoResizes = false;
infot2.Editable = true;
infot2.StringTrimming = StringTrimming.EllipsisWord;
infot2.Clipping = true;
infot2.TransparentBackground = false;
infot2.Text = "Hello there!";
infog.Add(infot2);
myMessage = infot2;
this.Body = infog;
this.Size = new SizeF(150, 100); // let LayoutChildren determine sizes and positions for the group's children
}
public override void LayoutChildren(GoObject childchanged) {
GoGroup grp = this.Body as GoGroup; // also lay out the children of the group (i.e. the grandchildren of this node)
if (grp == null || grp.Count < 4) return; // do nothing until Initialize'd
RectangleF r = this.Bounds; // get the Bounds before changing anything
GoObject rect = grp[0];
GoObject title = grp[1];
float border = 2;
rect.Bounds = new RectangleF(r.X, r.Y, r.Width, Math.Max(title.Height, myButton.Height+2)+border);
myButton.SetSpotLocation(TopRight, rect, TopRight, -border, border);
title.Bounds = new RectangleF(r.X+border, r.Y+border, r.Width-myButton.Width-2*border, title.Height);
myMessage.WrappingWidth = r.Width-2*border;
myMessage.Bounds = new RectangleF(r.X+border, rect.Bottom+1, r.Width-2*border, r.Height-rect.Height-2-2*border);
base.LayoutChildren(childchanged); // lays out Port using Body's Bounds
}
protected override void CopyChildren(GoGroup newgroup, GoCopyDictionary env) {
base.CopyChildren(newgroup, env);
InfoNode n = (InfoNode)newgroup;
n.myMessage = (GoText)env[myMessage];
n.myButton = (GoButton)env[myButton];
if (n.myButton != null) { // button's Action event handler is not copied
n.myButton.Action += new GoInputEventHandler(n.button_Action);
}
}
public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max) {
base.DoResize(view, origRect, newPoint, whichHandle, evttype, new SizeF(100, 50), max); // specify minimum resizing Size
}
private void button_Action(object sender, GoInputEventArgs e) {
MessageBox.Show("clicked button of " + this.Text);
}
public String Message {
get { if (myMessage != null) return myMessage.Text; else return ""; }
set { if (myMessage != null) myMessage.Text = value; }
}
private GoButton myButton = null;
private GoText myMessage = null;
}
}