Start Programming With MSAGL (GLEE) To Create Hierarchical Graph Layouts

Add Namespace as :

using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using Microsoft.Glee.Drawing;

STEP – 1
First create one form as

System.Windows.Forms.Form form = new System.Windows.Forms.Form();

STEP – 2
Now create GViewer and a Graph class object as

Microsoft.Glee.GraphViewerGdi.GViewer viewer = new Microsoft.Glee.GraphViewerGdi.GViewer();

STEP – 3

Now create graph elements and call Graph.AddEdge (StartNode, EndNode) function as

string Node1 = “N1”;

string Node2 = “N2”;

string Node3 = “N3”;

string Node4 = “N4”;

graph.AddEdge(Node1,Node2);

graph.AddEdge(Node2,Node1);

graph.AddEdge(Node3,Node3);

graph.AddEdge(Node3,Node4);

STEP – 4

Add graph on form and show graph as

viewer.Graph = graph;

form.SuspendLayout();

Viewer.Dock = System.Windows.Forms.DockStyle.Fill();

form.Controls.Add(viewer);

form.ResumeLayout();

form.ShowDialog();

It look like below image

n

You can save , print or customize your graph as per your need.

 

 

 

 

 

 

        

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s