0

I have a program that adds LineItems to a ZedGraph pane whenever data parameters are set and a submit button is pressed.

LineItem myCurve = Pane.AddCurve(Title, Data, Color.FromArgb(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255)), SymbolType.Diamond);

So that's all well and good. My problem is that I want to allow my users to remove specific curves one by one.

My only thought on this is to create a list of LineItems, remove a specific LineItem from the list, and replot all remaining LineItems.

My problem is that I don't know how I would be able to specify which LineItem I want to remove from my list.

sooprise
  • 22,657
  • 67
  • 188
  • 276
  • So the AddCurve method will obviously add an Item to a collection somewhere. Can you reflect it out to see if the collection is accessible? If so, then you might be able to access that collection directly to remove an item from it. – SamuelWarren Jun 30 '10 at 02:43

2 Answers2

1

If you're talking about List<LineItem>, then you can do list.Remove(lineItem) or list.RemoveAt(index).

Nelson Rothermel
  • 9,436
  • 8
  • 62
  • 81
0
pane.CurveList.Remove(myCurve);

and then

zg1.Refresh();

or

zg1.Invalidate();

(assuming zg1 is your ZedGraphControl)

Gacek
  • 10,184
  • 9
  • 54
  • 87