TreeLayout PerformLayout

I’m using the PerformLayout method of TreeLayout to layout my document. However each time I do so, the entire document is shifted including my head node and all children nodes…

My document only has one head node (using the extended MultiPortNode class) and many children nodes. There is no grandchildrens.
What i want to do is ensure only the children nodes move when I call PerformLayout... I don't want the parent node to move at all. Can this be done?
So each time I call PerformLayout, all the children nodes will layout according to where the parent node is located.
Any help greatly appreciated. Thanks in advance.

Set GoLayoutTree.Arrangement = GoLayoutTreeArrangement.FixedRoots.

You might want to set some of the other properties too, if you haven't already.

Thanks Walter,

I've tried that and it seems to work great. I also implemented the Fixed = true for all selected nodes; as shown in one of the installed examples.
However I have another related question - every time I do Perform layout, the nodes tend to arrange themselves to the top-left corner of the view. Even if my view is (full-dock) maximized, the nodes will always layout in the top-left.
What I want to do is layout the tree centered in view.
Any ideas?
Thanks.

GoLayout works on nodes and links in a GoDocument, and there might be multiple GoViews showing the same document. If two views were different sizes or were at different scales, where should the nodes be placed? Having a GoOverview window is an example of another view on the same document.

The GoLayoutTree.ArrangementOrigin property specifies the top-left corner for the laid-out graphs. There isn't a way to specify (say) the top-middle spot.
So you could either move everything after the PerformLayout(), or you could size the document and scroll the view so that the root node is in near the top-middle of the view.

cool… thanks.

I just used GoView.ScrollRectangleToVisible(GoDocument.ComputeBounds()); and everythings works great.