I have a gosubgraph object which is resizable. gosubgraph has LayoutHandle() and LayoutLabel() overridden to position handle and label in the top left of the subgraph rectangle. When user resizes the subgraph by dragging the sides of the subgraph background rectangle, rectangle size changes but ComputeBorder() functions returns old bounds of the subgraph. It seems that ComputeBorder() only returns correct size when subgraph autorescale itself when nodes within sungraph moves. I noticed that DoResize() is only called when user changes the subgraph size.


  1. How do I get Subgraph border syncronized with rectangle border when user resizes the background rectangle of the subgraph?

Do you want ComputeBorder or ComputeBounds? ComputeBounds returns “the union of all of the visible children and the result of ComputeBorder”.

Finally, I got it working as expected. I only needed to overwrite ComputeInsideMarginsSkip(). Somehow If I do not overwrite
ComputeInsideMarginsSkip() to skip margin for label object, I get very strange behavior when user resizes the subgraph.