0

I'm having trouble figuring out how to get this simple operation to work.

LineItem Curve = Pane.AddCurve(Name,Data,Color.blue,SymbolType.Diamond);
zgc.Refresh();

Now how do I remove the curve I just added?

Pane.CurveList.Remove()?' If so, how can I set an object equal to an existing curve to use as a parameter of method Remove()?

sooprise
  • 22,657
  • 67
  • 188
  • 276

2 Answers2

3

You pass in a reference to the curve that you created:

Pane.CurveList.Remove(Curve);

The documentation is available here.

Sam Holloway
  • 1,999
  • 15
  • 14
  • How do I set "Curve" to a specific curve? Looked at the documentation and couldn't find it. – sooprise Jun 28 '10 at 19:29
  • When you call 'AddCurve', it returns the Curve that you've just added, so you can keep a reference to that and then pass it into Remove when you're ready to remove it. – Sam Holloway Jun 28 '10 at 19:43
  • thanks. My program adds lines through a WinForm, and each time a line is added, it is set to "Curve". Is there a way to set each line to "Curve[i]" and have i iterate upwards automatically? Or is there a better way (I wouldn't be surprised) to uniquely identify each curve? – sooprise Jun 28 '10 at 19:59
1

Untested but...

Pane.CurveList[ Pane.CurveList.Count - 1  ].Clear();
zgc.Refresh();
Mark
  • 106,305
  • 20
  • 172
  • 230