Code:
Private Sub UserControl_Resize()
    Dim a As Object
    For Each a In UserControl.ContainedControls
        If a.Width + a.Left > UserControl.Width Then UserControl.Width = a.Left + a.Width
        If a.Height + a.Top > UserControl.Height Then UserControl.Height = a.Top + a.Height
    Next a
End Sub