Public Sub CenterParent(ByVal c As Control)
If c Is Nothing OrElse c.Parent Is Nothing Then Return
Dim p As New Point(c.Parent.ClientSize - c.Size)
c.Location = New Point(p.X \ 2, p.Y \ 2)
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Me.CenterParent(Me.Panel1)
End Sub