Finally, the gadget that actually paints the Panel is:
Private Sub panMap_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles panMap.Paint
Dim g As Graphics = e.Graphics
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim MyPen As Pen
Dim MyBrush As SolidBrush
For I = 0 To MaxRoom
With MapArray(I)
If .Visible Then
If ShowLines Then
MyPen = New Pen(Color.Blue, 2)
For J = 0 To MaxWall
K = Math.Abs(Room(I, J, Roo.RoomNr))
If (K >= 0) AndAlso _
(K <= MaxRoom) AndAlso _
(Math.Abs(I - K) > 1) Then
If MapArray(K).Visible Then
g.DrawLine(MyPen, _
Convert.ToSingle( _
MapArray(K).CenterX + .CircleSize / 2), _
Convert.ToSingle( _
MapArray(K).CenterY + .CircleSize / 2), _
Convert.ToSingle( _
.CenterX + .CircleSize / 2), _
Convert.ToSingle( _
.CenterY + .CircleSize / 2))
End If
End If
Next J
End If
If .Fill Then
MyBrush = New SolidBrush(.PenColor)
g.FillEllipse( _
MyBrush, .CenterX, .CenterY, .CircleSize, .CircleSize)
Else
MyPen = New Pen(.PenColor, .PenWidth)
g.DrawEllipse( _
MyPen, .CenterX, .CenterY, .CircleSize, .CircleSize)
End If
End If
End With
Next I
End Sub

