set vertex location in windows form

Jun 14, 2010 at 12:03 PM

I created a windows form displaying nodexl graph using code describle in help file. I would like apply saved vertex location to my view but looking to help file it seem that "vertex.Location" doesn't work directly in viewer  : "This property is set when the graph is laid out by ILayout.LayOutGraph and is read when the graph is drawn" . Is there another way to set vertices location ?

Thanks a lot for your help.

Jun 14, 2010 at 5:46 PM
Edited Jun 14, 2010 at 5:51 PM

You might be misinterpreting the Remarks section of the documentation for Vertex.Location.  That's how the property is usually used, but the property is actually read/write and you can use it in other ways as well.  In your case, set all the vertex locations to their saved values, then call NodeXLControl.DrawGraph(false), which will draw the graph without laying it out.

In the next version of NodeXL, the Remarks for Vertex.Location will be changed to the following:

"Typically, this property is set when the graph is laid out by ILayout.LayOutGraph and is read when the graph is drawn. It's also possible to explicitly set all of the graph's vertex locations using this property and then bypass the layout stage. You might do this when you want to restore vertex locations that have been saved from a previous layout, for example."

-- Tony

Jun 15, 2010 at 12:30 PM

Works fine now. Thanks a lot for your explantion.