zedGraph后台保存图片,并设置节点为原点

private static void SavePic(List modelList, String picPath)
        {
            ZedGraphControl zgc = new ZedGraphControl();
            zgc.Width = 800;
            zgc.Height = 600;

            Random ran = new Random();
            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            zgc.GraphPane.Title.Text = "";
            zgc.GraphPane.XAxis.Title.Text = "次数";
            zgc.GraphPane.YAxis.Title.Text = "时间(ms)";
            zgc.GraphPane.XAxis.MajorGrid.IsVisible = true;
            zgc.GraphPane.YAxis.MajorGrid.IsVisible = true;

            zgc.GraphPane.XAxis.Type = ZedGraph.AxisType.LinearAsOrdinal;


            foreach (Model model in modelList)
            {
                LineItem item = zgc.GraphPane.AddCurve(model.Label, model.List, model.Color, SymbolType.UserDefined);
                item.Symbol = new Symbol(SymbolType.UserDefined, model.Color);
                item.Symbol.Fill = new Fill(model.Color);
                GraphicsPath path = new GraphicsPath();
                path.AddEllipse(-0.2f, -0.2f, 0.4f, 0.4f);
                item.Symbol.UserSymbol = path;
            }
            zgc.AxisChange();
            zgc.Refresh();

            zgc.GetImage().Save(picPath);
        }

你可能感兴趣的:(C#,技术总结)