Invalidate means that your paint area is no longer valid..
ie, if the user resized the window and all your drawing proportions
should react to that event or if something should be deleted from
your drawing while it is over something else and etc..
So it is logical to assume that if you want to react to "Invalidate"
you need to delete the area and everything should be re-drawn.
So - that been explained but what you really need is some array
that holds the elements you need to draw and use invalidate
to draw them.. ie: (I'll write it in pseudo code)
List<Shape> Shapes = new List<Shape>();
ctor:
Shapes.Add(rect1);
Shapes.Add(rect2);
...
and so on..
void some_user_incoming_event(){
shapes.Add(rect200);
Invalidate();
}
public void Invalidate()
{
foreach(var shape in shapes) {code to draw specific shape}
}
If you would use that tactic you will get to the result you want but
as mentioned in the notes above this answer - you need to stop
calling invalidate every x msecs.. or you will see flickering.
Instead of that - you need to call Invalidate manually each time something
has changed.
This tactic is also known as MVP (model-view-presenter) where
the List is your model, your graphics area is your view,
and your Invalidate() method is your presenter.
I hope this helps.