I want to put an outline around each control on a panel, as a test case I used some checkboxes. It draws the outlines fine, but if I mouseover the checkboxes, they dont repaint. I cant see anything wrong with this (or I might have code blindness). Can anyone see what's wrong?

VB Code:
  1. Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
  2.     Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Integer) As Integer
  3.     Dim MyPanel As New Panel
  4.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  5.         Dim d As IntPtr = New IntPtr(GetWindowDC(MyPanel.Handle.ToInt32))
  6.         Dim g As Graphics = Graphics.FromHdc(d)
  7.         PaintCon(MyPanel, g)
  8.         g.Dispose()
  9.     End Sub
  10.     Private Sub PaintCon(ByVal Con As Control, ByVal g As Graphics)
  11.         For Each ctl As Control In Con.Controls
  12.             If ctl.Controls.Count > 0 Then
  13.                 PaintCon(ctl, g)
  14.             Else
  15.                 If ctl.GetType.ToString.ToLower = "system.windows.forms.checkbox" Then
  16.                     Dim ConRect As New Rectangle(MyPanel.PointToClient(ctl.Parent.PointToScreen(ctl.Location)), ctl.Size)
  17.                     g.DrawRectangle(Pens.Black, ConRect)
  18.                     RemoveHandler Con.Paint, AddressOf ConPaint
  19.                     AddHandler Con.Paint, AddressOf ConPaint
  20.                 End If
  21.             End If
  22.         Next
  23.     End Sub
  24.     Private Sub ConPaint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)
  25.         Dim con As Control = DirectCast(sender, Control)
  26.         Dim ConRect As New Rectangle(MyPanel.PointToClient(con.Parent.PointToScreen(con.Location)), con.Size)
  27.         e.Graphics.DrawRectangle(Pens.Black, ConRect)
  28.     End Sub