当前位置: 首页>>代码示例>>C#>>正文


C# Graph.Write方法代码示例

本文整理汇总了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);
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:22,代码来源:test.cs

示例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;
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:32,代码来源:App.cs


注:本文中的Microsoft.Msagl.Drawing.Graph.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。