See if this helps.
2 Buttons.
Public Class Form1
Private LocationArray() As String = {"5,40,50,100", "75,125,30,45", "150,90,50,75", "75,40,180,25", "5,200,250,25"}
Private penBlack As New Pen(Color.Black, 3) '// Default Color.
Private penRed As New Pen(Color.Red, 3) '// Selection Color.
Private arTemp() As String = Nothing '// .Split Locations Strings into(location.X, location.Y, width, height)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Visible = True
drawRectangles()
End Sub
'// Draw ALL Rectangles as Default Color.
Private Sub drawRectangles()
Dim myGraphics As Graphics = Me.CreateGraphics
For Each rect As String In LocationArray '// Loop thru all Locations Strings.
arTemp = rect.Split(",") '// Split into 4 Arrays.
myGraphics.DrawRectangle(penBlack, CInt(arTemp(0)), CInt(arTemp(1)), CInt(arTemp(2)), CInt(arTemp(3))) '// draw Rectangle.
Next
End Sub
'// Draw ALL Rectangles as Default Color AndAlso Draw the SELECTED Rectangle as Selection Color.
Private Sub drawSelectedRectangle(ByVal RectangleLocationAndSizeFromStringArray As String)
drawRectangles() '// Redraw all Rectangles to set ALL to Default Color.
Dim myGraphics As Graphics = Me.CreateGraphics
arTemp = LocationArray(RectangleLocationAndSizeFromStringArray).Split(",") '// Split into 4 Arrays.
'// Redraw a Selected Rectangle, with the Selection Color.
myGraphics.DrawRectangle(penRed, CInt(arTemp(0)), CInt(arTemp(1)), CInt(arTemp(2)), CInt(arTemp(3))) '// draw Rectangle.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
drawSelectedRectangle(3) '// 4th in LocationArray().
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
drawSelectedRectangle(1) '// 2nd in LocationArray().
End Sub
End Class