Node Size


I want to show nodes only when I need to see them, also keep nodes size all zero when they are not shown. What I did was that:when nodes were created, set node size to zero:
float w = 0F, float h = 0F;
node.Bounds = new RectangleF((float)x,(float)y, w, h);
and then make them invisible. I have tried 2 ways to set node size non-zero when I need to show nodes, one way is
NodeSize = new SizeF(5.0F,5.0F);
PointF Loc = node.Location;
node.Location = Loc;
another way is:
PointF Loc = node.Location;
node.Bounds = new RectangleF(Loc.X,Loc.Y,5.0F,5.0F);
both ways don’t work, the nodes don’t show up when I make them visible, any clues why these don’t work? or any better suggestions?
By the way, the reason I set nodes size to zero is if I don’t set node size to zero, even I hide the nodes, the bounds of nodes still appear, there will be a gap between links.


It really depends on the classes that implement your nodes–their behavior when you change the Size is controlled by their implementation (overrides) of the GoGroup.RescaleChildren and GoGroup.LayoutChildren methods.
I suspect that when you set the size of a node to 0x0 the child shapes in your node are also being resized to 0x0 (by GoGroup.RescaleChildren). Then when you change the size back to 5x5, the shapes are scaled up again, but because they were 0x0 they remain 0x0, so you don’t see them afterwards.
Why don’t you try doing:
node.Size = new SizeF(0.5f, 0.5f);
node.Visible = false;
and then later:
node.Size = new SizeF(5, 5);
node.Visible = true;
By avoiding setting any part dimensions to zero, you’ll let them scale up properly when you change the size of the whole node.


Thanks for the support