Good day! I have a database in which information about the connections of objects is stored. All objects are of the same type, and each object is associated with other objects. Suppose there are two classes:

class Object { public int Id{get;set;} public string Name{get;set;} public Object(int id, string name) { Id = id; Name = name; } } class Relation { public Object obj1{get;set;} public Object obj2{get;set;} public Relation(Object o1, Object o2) { obj1 = o1; obj2 = o2; } } 

And let the data be stored in this way:

 List<Relation> relations = new List<Relation>(); 

based on the available data, I implemented the generation of a DGML file that would visually reflect the connections of the objects. I’ve got a graph, for example, like this: http://www.softwareprocessengineering.com/_SPDiag/DGMLNOGroups.jpg But the problem is that windows forms do not have an element of management that can reflect the DGML file directly on the form, and there is no method which would allow to convert DGML to image. What alternative way could I implement such an image? I tried to implement it manually through Graphics, but I have no idea how to sort objects in such a way that the graph is ordered as in DGML and “porridge-mala” does not come out. How can you implement DGML-like visualization?

    1 answer 1

    I think the GraphX library will do.

    In the source code a lot of examples on using

    • there was such a problem with GraphX ​​if I have two connections of the type object1-> object2, and I need to reflect both graphically, building each of them with dataEdge = new DataEdge (o1, o2) {Text = line.Type}; (line.Type - type of connection) on the graph itself only one connection is reflected, how can I reflect two? I study the documentation, but have not yet encountered the answer to such a question. - Paul
    • I also noticed that if I set the graph to allowParallelEdges to false, in that case I can only see the first link, and if true, only the second one. Thus, they overlap, but you must see them at the same time. - Paul