ZedGraph填充区域

Ser*_*gey 5 c# graphics zedgraph

我正在使用ZedGraph控件,并希望在图形函数的一侧填充一些颜色,而另一侧填充其他颜色.

 PointPairList list1 = new PointPairList();
 list1.Add(0, 4);
 list1.Add(4, 0);
 LineItem myCurve = myPane.AddCurve("y(n)", list1, Color.Red, SymbolType.Diamond);

 //This filling bottom side.
 myCurve.Line.Fill = new Fill(Color.White, Color.FromArgb(113, 255, 0, 0), 90F);

 //How to fill the top side?
Run Code Online (Sandbox Code Playgroud)

dav*_*v_i 6

我不太清楚你在问什么 - 但希望下面的内容会有所帮助.你在评论中说

我可以在Zedgraph中填充一些多边形区域吗?

那么这就是......

var zed = new ZedGraph.ZedGraphControl { Dock = System.Windows.Forms.DockStyle.Fill };

var poly = new ZedGraph.PolyObj
{
    Points = new[]
    {
        new ZedGraph.PointD(0, 0),
        new ZedGraph.PointD(0.5, 1),
        new ZedGraph.PointD(1, 0.5),
        new ZedGraph.PointD(0, 0)
    },
    Fill = new ZedGraph.Fill(Color.Blue),
    ZOrder = ZedGraph.ZOrder.E_BehindCurves
};

var poly1 = new ZedGraph.PolyObj
{
    Points = new[]
    {
        new ZedGraph.PointD(1, 0),
        new ZedGraph.PointD(0.25, 1),
        new ZedGraph.PointD(0.5, 0),
        new ZedGraph.PointD(1, 0)
    },
    Fill = new ZedGraph.Fill(Color.Red),
    ZOrder = ZedGraph.ZOrder.E_BehindCurves
};

zed.GraphPane.AddCurve("Line", new[] { 0.0, 1.0 }, new[] { 0.0, 1.0 }, Color.Green);
zed.GraphPane.GraphObjList.Add(poly1);
zed.GraphPane.GraphObjList.Add(poly);
Run Code Online (Sandbox Code Playgroud)

结果是

在此输入图像描述

希望这会指出你正确的方向!

(通过http://converter.telerik.com/ 请求 VB中的代码 - 无法保证VB代码正常工作甚至编译!)