forked from microsoft/automatic-graph-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (35 loc) · 1.54 KB
/
Program.cs
File metadata and controls
46 lines (35 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using Microsoft.Msagl.Drawing;
using Microsoft.Msagl.Layout.Incremental;
using Microsoft.Msagl.Layout.Layered;
using Microsoft.Msagl.Layout.MDS;
namespace LoadingDgmlGraph {
class Program {
[STAThread]
static void Main(string[] args) {
Microsoft.Msagl.GraphViewerGdi.DisplayGeometryGraph.SetShowFunctions();
//create a form
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
//create a viewer object
Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();
//associate the viewer with the form
form.SuspendLayout();
viewer.Dock = System.Windows.Forms.DockStyle.Fill;
form.Controls.Add(viewer);
form.ResumeLayout();
//create a graph object
Graph graph = DgmlParser.DgmlParser.Parse("fullstring.dgml");
SugiyamaLayoutSettings ss = graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings;
// uncomment this line to see the wide graph
// ss.MaxAspectRatioEccentricity = 100;
// uncommment this line to us Mds
// ss.FallbackLayoutSettings = new MdsLayoutSettings {AdjustScale = true};
// or uncomment the following line to use the default layering layout with vertical layer
// graph.Attr.LayerDirection = LayerDirection.LR;
viewer.Graph = graph;
form.ShowDialog();
}
}
}