Quenstions about GoBoxNode

Hi Support!

Based in this example code that support sent for me as an example to draw this image…I have 2 problems…And I need your help. Thanks!

1 ) Why when user is changing the width of this object… changes the position X too, together??

  1. I created 2 objects MyDisplay99 and link its.
    After …I saved xml file,… and ok! But When user loaded xml file, the link was not load.

        t = new GoXmlBindingTransformer("mydisplay", new MyDisplay99());
        t.HandlesChildren = true;                
        t.IdAttributeUsedForSharedObjects = true; 
        t.AddBinding("label", "Text");
        t.AddBinding("port", "Port");
        t.AddBinding("bounds", "Grid.Bounds");

t = new GoXmlBindingTransformer(“link”, new GraphLink());
t.AddBinding(“from”, “FromPort”);
t.AddBinding(“to”, “ToPort”);
t.AddBinding(“label”, “Text”);
t.AddBinding(“pen”, “Pen.DashStyle”);
t.AddBinding(“toarrow”, “ToArrow”);
t.AddBinding(“fromarrow”, “FromArrow”);
t.AddBinding(“fromarrowstyle”, “FromArrowStyle”);
t.AddBinding(“fromarrowfilled”, “FromArrowFilled”);
t.AddBinding(“fromarrowlength”, “FromArrowLength”);
t.AddBinding(“fromarrowwidth”, “FromArrowWidth”);
t.AddBinding(“fromarrowshaftlength”, “FromArrowShaftLength”);

–> Class code:


public class MyDisplay99 : GoBoxNode {


private int CellGridSize = 1;

public MyDisplay99() {

  this.LinkPointsSpread = true;

  this.PortBorderMargin = new SizeF(1, 1);

  this.Port.BrushColor = Color.White;

  this.Port.PenColor = Color.Black;

  this.Resizable = true;


protected override GoObject CreateBody() {

  GoGroup boxgroup = new GoGroup();

  boxgroup.Selectable = false;



  return boxgroup;


//Create Grid

protected virtual GoGrid CreateGrid() {

  GoGrid grid = new GoGrid();

  grid.Selectable = false;

  grid.AutoRescales = true;

  grid.Resizable = true;

  grid.ResizesRealtime = true;

  grid.Bounds = new RectangleF(0, 0, 150, 100);

  grid.SnapDrag = GoViewSnapStyle.Jump;

  grid.SnapResize = GoViewSnapStyle.Jump;

  grid.CellSize = new SizeF(CellGridSize, CellGridSize);

  grid.Style = GoViewGridStyle.None;

  grid.Pen = new Pen(Color.Black, 2);

  grid.BrushColor = Color.White;

  return grid;


//Create label

protected virtual RotatedTextHolder CreateLabel() {

  RotatedTextHolder holder = new RotatedTextHolder();

  //Label Left Side

  RotatedText label = holder[0] as RotatedText;

  label.Multiline = true;

  label.Editable = true;

  label.FontSize = 11;

  label.TransparentBackground = false;

  label.Bordered = true;

  label.AutoResizes = false;

  label.StringTrimming = StringTrimming.EllipsisCharacter;

  label.Alignment = Middle;

  label.Text = "label here";

  label.Angle = 270;

  return holder;


//Get Label

public override GoText Label {

  get {

    RotatedTextHolder holder = this.TextHolder as RotatedTextHolder;

    if (holder == null) return null;

    foreach (GoObject o in holder) {

      if (o is RotatedText) return o as GoText;


    return null;



//Get Label Holder

public virtual RotatedTextHolder TextHolder {

  get {

    GoGroup body = this.Body as GoGroup;

    if (body == null) return null;

    foreach (GoObject o in body) {

      if (o is RotatedTextHolder) return o as RotatedTextHolder;


    return null;



//Get Grid

public virtual GoGrid Grid {

  get {

    GoGroup body = this.Body as GoGroup;

    if (body == null) return null;

    foreach (GoObject o in body) {

      if (o is GoGrid) return o as GoGrid;


    return null;



//Object layout changed

public override void LayoutChildren(GoObject childchanged) {

  if (this.Count >= 2 && !Initializing) {

    GoGrid grid = this.Grid;

    GoText label = this.Label;

    if (grid != null && label != null) {

      label.Width = grid.Height;

      PointF center = grid.GetSpotLocation(MiddleLeft) - new SizeF(label.Height / 2 + 1, 0);

      label.Center = center;






We’re in the middle of a big infrastructure change here, so I’m not going to be able to look at the resize thing until next week. For the XML problem, check the Trace Output in the debugger, see if you are getting any errors. (The code looks ok to me.)

  1. ok. If you do a test with this code, you will see this resize problem…I will wait next week.

  2. ok. I will wait your help until next week about save/load Port/Link information of GoBoxNode.


Did you have time to see this topic?

The movement in a resize is a problem in LayoutChildren, in the way the label is positioned. I don’t have a fix yet, but I’m working on it.

ok I will wait.

I’ve mailed you some new code.