private void tbInputTest_Paint(object sender, PaintEventArgs pe)
{
//Get the Graphics object
g = pe.Graphics;
//Create an array of rectangles
Circles = new RectangleF
for (int i = 0; i < 8; i++)
{
Circles
g.FillEllipse(Brushes.White, Circles
g.DrawEllipse(Pens.Black, Circles
}
}
I have a button that when pressed will update the fill color of one of the circle. how i do that I mean how to propagate the graphic handle toward the whole program. by the way the circles appear on a tab control which make thing not that easy.

how to update graphic in a different function
Hawkins
Agreed. Do all your painting in one place.
It makes it tremendously difficult to debug if you do it otherwise.
AlienRancher
All the drawing should be done in the paint event handler as you do in your example. The best way is probably to define your own myShape class at class scope something like this pseudo code:
class myShape
{
RectangleF rect;
bool filled;
Color fillColor;
Position point;
}
Create an array of these at class scope. From your button event handler, set the filled variable or other properties, then call "Invalidate" which will send a paint event and cause the paint event handler to be called. In the paint method, foreach over the myShape array and do the drawing based on how the variables are set in each element of the array.
Michael Blome - Visual C# Documentation team