I couldn't work with WPF so I used elementHost in Winform.
In my project (graph draw with Graph#) I can draw vertices and edges but I couldn't put label on edges.
Code :
string[] vertices = new string[] { "A", "B", "C" };
var g = new BidirectionalGraph<object, IEdge<object>>();
g.AddVertexRange(vertices);
g.AddEdge(new Edge<object>(vertices[0], vertices[1]));
g.AddEdge(new Edge<object>(vertices[1], vertices[2]));
g.AddEdge(new Edge<object>(vertices[0], vertices[2]));
graphLayout.Graph = g;
You can create a color legend rather than labels and then color the edges.
if (FirstCase
{
g.AddVertex("A");
Color edgeColor = Colors.Green;
g.AddVerticesAndEdge(new MyEdge("A", "B")
{
EdgeColor = edgeColor
});
}
if (SecondCase
{
g.AddVertex("B");
Color edgeColor = Colors.Red;
g.AddVerticesAndEdge(new MyEdge("B", "C")
{
EdgeColor = edgeColor
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.