Removing Specific LineItems One By One
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.
If you're talking about List<LineItem>
, then you can do list.Remove(lineItem)
or list.RemoveAt(index)
.
pane.CurveList.Remove(myCurve);
and then
zg1.Refresh();
or
zg1.Invalidate();
(assuming zg1
is your ZedGraphControl)
精彩评论