Center node


I'd like to write a function that gets a node and moves the graph in a way that the selected node will be in the center of the view. How do I do that?
I've tried using the RescaleWithCenter function and giving it the position of the selected node, but that's not it...

That’s the right idea. Or since you probably don’t need to change the view scale (zoom), you could do:

goView1.DocExtentCenter = node.Center
If your GoDocument isn't large enough to allow you to scroll the view far enough to actually center the object, you can either set the GoDocument.TopLeft and .Size properties appropriately, or you can set GoView.SheetStyle to GoViewSheetStyle.Sheet.

my GoView doesn’t have this property DocExtentCenter

I'm using GoDiagram 2.5.2. was it added recently?

Yes, that was new in 2.6.

But you can keep using RescaleWithCenter if you want, passing in the current GoView.DocScale to as to avoid changing the scale.

I figured out how to upgrade the license. I just use my existing unlock codes with the new version’s licensing manager.