Get and Set X and Y coordinates of Vertex.

Feb 5, 2010 at 12:06 PM

Hi,

Does anyone have a sample/workaround to get and set the X and Y Coordiantes of a vertex on a Bidirectional graph.

I am trying to drag and drop vertices from a list on the side onto the graph, which works, but they do not get created where I dropped them, they are created in the center of the screen.

Any ideas will be appreciated,

rootme

Feb 8, 2010 at 1:13 PM

Ok.

I can drag and drop vertices from a list of icons onto the graph. I can also link them on the canvas with a line like link thing.

I just need to get and set the X and Y of the vertices for layout reasons.

How does the layout algorithms set the X and Y of the vertices? Is there some method I can call???

thanks,

 

rootme

Jul 12, 2011 at 9:15 AM

 

IDictionary vertexPositions = new Dictionary(graph.VertexCount);
            vertexPositions = graphLayout.GetLatestVertexPositions();

but first you should change something, GetLatestVertexPositions() is a method in GraphSharp.Controls.GraphLayout change its return type from private to public