如何在一个用户控件上动态创建多个图表

时间:2016-11-17 17:22:09

标签: plot graph charts

我创建了一个用户控件并在其上绘制了一个图表。问题是我需要多个通道同步。我目前正在添加控件并将绘图添加到每个控件。但我需要9个频道,并且我希望能够让用户确定使用一个控件的频道数。

我以为我可以把它变成一个像下面这样的数组,但它一直在崩溃:

readonly PlotArea[] LineGraphArea = new  PlotArea[2];

this.LineGraphArea[0].Width = this.WrapperPlot.Width - 100;
this.LineGraphArea[0].Height = this.WrapperPlot.Height - 2;
this.LineGraphArea[0].Top = this.WrapperPlot.Top + 2;
this.LineGraphArea[0].Left = this.WrapperPlot.Left + 6;
this.LineGraphArea[0].BackColor = BackgroundColor;
this.Controls.Add(this.LineGraphArea[0]);

我知道我可以这样做:

readonly PlotArea LineGraphArea1 = new  PlotArea();
readonly PlotArea LineGraphArea2 = new  PlotArea();
readonly PlotArea LineGraphArea3 = new  PlotArea();

但我确信这样做更容易,更有效。

0 个答案:

没有答案