本文整理汇总了C#中Microsoft.Msagl.Drawing.Graph.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.Write方法的具体用法?C# Graph.Write怎么用?C# Graph.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Msagl.Drawing.Graph
的用法示例。
在下文中一共展示了Graph.Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSave
static void TestSave() {
var g = new Graph();
g.AddEdge("a", "b");
var gv = new GViewer();
gv.CalculateLayout(g);
const string fileName = "c:\\tmp\\saved.msagl";
g.Write(fileName);
g = Graph.Read(fileName);
var f = new Form();
f.SuspendLayout();
f.Controls.Add(gv);
gv.Dock = DockStyle.Fill;
gv.NeedToCalculateLayout = false;
gv.Graph = g;
f.ResumeLayout();
f.ShowDialog();
Environment.Exit(0);
}
示例2: GiveGraphToControl
void GiveGraphToControl(Graph gwgraph) {
if (argsParser.OptionIsUsed(RoundedCornersOption))
foreach (var n in gwgraph.Nodes) {
n.Attr.Shape = Shape.Box;
n.Attr.XRadius = n.Attr.YRadius = 3;
}
SetLayoutSettings(gwgraph);
if (argsParser.OptionIsUsed(RunRemoveOverlapsOption)) {
var compGraph = gwgraph.GeometryGraph;
switch (new MdsLayoutSettings().OverlapRemovalMethod) {
case OverlapRemovalMethod.Prism:
ProximityOverlapRemoval.RemoveOverlaps(compGraph, gwgraph.LayoutAlgorithmSettings.NodeSeparation);
break;
case OverlapRemovalMethod.MinimalSpanningTree:
OverlapRemoval.RemoveOverlaps(compGraph.Nodes.ToArray(), gwgraph.LayoutAlgorithmSettings.NodeSeparation);
break;
default:
throw new ArgumentOutOfRangeException();
}
if (graphViewer.MsaglFileToSave != null) {
gwgraph.Write(graphViewer.MsaglFileToSave);
Console.WriteLine("saved into {0}", graphViewer.MsaglFileToSave);
Environment.Exit(0);
}
}
graphViewer.Graph = gwgraph;
}