I am working on a control to draw some graphs. For this purpose I want to derive a control from PictureBox and add a field to it which basically a List of following simple class:
public class Curve
{
public List<PointF> DataPoints;
public Color CurveColor;
//and constructor and stuff
}
And the PictureBox class:
public class Graph : PictureBox
{
List<Curve> Curves;
//And some code to take care of drawing the curves
}
So I really apriciate some tips here, is there a way to hook up an event so whenever a Curve object is being added or removed in the Graph class, it redraws itself with remaining curve objects?
I found some details here here but this is for ArrayList
One way could be to use an ObservableCollection into your Graph class then listen to its CollectionChanged Event to Redraw your Graph.