Resize subgraph

Hi!

Why, when user resize subgraph, and moves GoIconicNode inside GoSubGraph, Gosubgraph resize?

Thanks

May I known when gosubraph resize end?

In general, the GoView.ObjectResized event is raised when the user finishes resizing a GoObject.

Specifically, the GoObject.DoResize method is called during the resizing process. When the evttype argument is GoInputState.Finish, the user has just finished resizing.

Thank you Walter for reply. Have GoSubGraph methods likes that DoBeginUpdate and DoEndUpdate? I want to do own layout on resize GoSubGraph.

As with any GoGroup class, you just need to override LayoutChildren if you want to resize and/or reposition any of the child objects for the group.

Note that for the GoSubGraph class, LayoutChildren is already overridden to call the various Layout… methods that are specific for GoSubGraph. Depending on what you want to do with the standard parts (Handle, Label, Port, and CollapsedObject, if you have those parts in your subgraphs), you may or may not want to call the base method first.

Please help me, how right to do, after resize I want to place the objects there not contains in resized GoSubGraph to botom. Example







P.S. I hope you understand me. English is not my native language.

[code] [Serializable]
public class WrappingSubGraph : GoSubGraph {
public WrappingSubGraph() {
this.Resizable = true;
}

public override void DoResize(GoView view, RectangleF origRect, PointF newPoint,
                              int whichHandle, GoInputState evttype, SizeF min, SizeF max) {
  RectangleF box = ComputeResize(origRect, newPoint, whichHandle, min, max,
                                 CanReshape() && view.CanReshapeObjects());
  view.DrawXorBox(view.ConvertDocToView(box), evttype != GoInputState.Finish);
  this.WrappingWidth = (float)(Math.Floor((box.Width+4)/this.CellSize.Width)*this.CellSize.Width);
}

public void WrappingLayout() {
  if (this.Initializing) return;
  GoObject first = null;
  float x = 0;
  float y = 0;
  float max = 0;
  foreach (GoObject c in this) {
    if (ComputeCollapsedSizeSkip(c)) continue;
    if (first == null) {
      first = c;
      x = first.Center.X;
      y = first.Center.Y;
      max = x + this.WrappingWidth - this.CellSize.Width;
    }
    c.Center = new PointF(x, y);
    x += this.CellSize.Width;
    if (x > max) {
      x = first.Center.X;
      y += this.CellSize.Height;
    }
  }
}

public SizeF ComputeCellSize(float padwidth, float padheight) {
  float maxw = 0;
  float maxh = 0;
  foreach (GoObject c in this) {
    if (ComputeCollapsedSizeSkip(c)) continue;
    maxw = Math.Max(maxw, c.Width);
    maxh = Math.Max(maxh, c.Height);
  }
  return new SizeF(maxw+padwidth, maxh+padheight);
}


public SizeF CellSize {
  get { return myCellSize; }
  set {
    SizeF old = myCellSize;
    if (old != value) {
      myCellSize = value;
      Changed(ChangedCellSize, 0, null, MakeRect(old), 0, null, MakeRect(value));
      WrappingLayout();
    }
  }
}
private SizeF myCellSize = new SizeF(100, 100);
public const int ChangedCellSize = LastChangedHint + 11;

public float WrappingWidth {
  get { return myWrappingWidth; }
  set {
    float old = myWrappingWidth;
    if (old != value && value > 0) {
      myWrappingWidth = value;
      Changed(ChangedWrappingWidth, 0, null, MakeRect(old), 0, null, MakeRect(value));
      WrappingLayout();
    }
  }
}
private float myWrappingWidth = 1000;
public const int ChangedWrappingWidth = LastChangedHint + 12;

public override void ChangeValue(GoChangedEventArgs e, bool undo) {
  if (e.SubHint == ChangedCellSize) {
    this.CellSize = e.GetSize(undo);
  } else if (e.SubHint == ChangedWrappingWidth) {
    this.WrappingWidth = e.GetFloat(undo);
  } else {
    base.ChangeValue(e, undo);
  }
}

}[/code]

Example use:

WrappingSubGraph wsg = new WrappingSubGraph(); wsg.Text = "WrappingSubGraph"; // initialize with twenty nodes Random myRandom = new Random(); for (int i = 0; i < 20; i++) { GoBasicNode n = new GoBasicNode(); n.LabelSpot = GoObject.Middle; n.Text = myRandom.Next(100).ToString(); wsg.Add(n); } wsg.CellSize = wsg.ComputeCellSize(10, 10); // figure out smallest cell size, but add 10 in both directions wsg.WrappingWidth = wsg.CellSize.Width * 5; // start off with 5 columns wsg.Position = new PointF(100, 100); goView1.Document.Add(wsg);

I hope I understood your requirements. English isn’t my native language either.

thank you Walter very much!!!