Posted: 8/24/2011
I have a bunch of rectangles within a picture box which i drew using the DrawRectangle method of the Graphics object. The code is similar to what is below:
Dim pen As New Pen(Brushes.LightSteelBlue, 2) Dim r As Rectangle = New Rectangle(10, 10, 100, 200) g.DrawRectangle(pen, r)
This works fine. However, once the user clicks a button I would like to redraw all of the rectangles in my picturebox with a new color. How would I loop through the rectangles in my picturebox and redraw each rectangle with a new color?