When I try to resize an empty GoSubgraph it jumps. It happens in the Subgraph sample application, when I make a subgraph then delete all its children.
can i prevent this?
That behavior has been improved for version 2.5.
Yes, it works fine in 2.5.
Another issue, how can i resize a subgraph from within the code? When I resize using:
myGraph.Size = new SizeF(100, 200);
nothing happened, and the Size property reamined the same.
Another last thing, how can I resize the subgraph without changing the margin?
The size of any GoGroup is normally determined by the union of the Bounds of the child objects. For most groups setting the Size will call RescaleChildren in order to scale up or scale down the children appropriately. However, that doesn’t make sense for a GoSubGraph because it holds nodes and links.
You can change the size of the border rectangle of a GoSubGraph, without moving any nodes, by setting the margins.
So unless you want to change the sizes and/or positions of the nodes in a subgraph, I don’t think it makes sense to change the size of a subgraph except by changing the margins.
So there’s no way to resize an empty subgraph to a specific size, then add a node to this graph and keep its original size.
If I resize a subgraph, its margins will get bigger, then when adding a node, it will try to keep its margins size so it will get bigger.
am i right?
I’m just making sure
Another thing that may be worth looking at is adding a couple of nodes (small squares or something like selection handles). The nodes can then be moved to simulate the resizing of the subgraph. I’m sure I have seen this in a sample somewhere.
I just checked and its in the Demo1 app, its at the bottom called LimitingSubGraph.
Yes, cmellon has it right – you could try something like the LimitingSubGraph example class for a user-resizable subgraph. The assumption there is that you want to treat a subgraph as a “box” that cannot be expanded by moving its child nodes. That class offers two different bits of functionality.
(1) Users cannot drag child nodes beyond the border of the subgraph. This is implemented by using the IGoDragSnapper mechanism.
(2) Two special “handles”, implemented by LimitingSubGraphMarker, allow the user to resize the “box” in the normal GoSubGraph manner.
I’m not sure exactly what behavior you want, but you might be interested in using (2) without having (1). You can do that by just deleting the implementation of IGoDragSnapper (two methods and one property) from the definition of LimitingSubGraph.