tags:

views:

32

answers:

2

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()?

A: 

Untested but...

Pane.CurveList[ Pane.CurveList.Count - 1  ].Clear();
zgc.Refresh();
Mark
+1  A: 

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

Pane.CurveList.Remove(Curve);

The documentation is available here.

Sam
How do I set "Curve" to a specific curve? Looked at the documentation and couldn't find it.
Soo
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
@Sam, 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?
Soo