title: "Glitch" on Winforms Panel when overriding OnPaint
body: <p>I'm trying to put a customized title on a Panel, it is displaying but when I scroll using scroll bar the title is painted but it's not always erased, so it displays a lot of titles as I'm scrolling up again.</p>
  
  <p>Any ideas on what I'm doing wrong?</p>
  
  <p>The code is something like:</p>
  
  <pre><code>Public Class MyPanel
      Inherits Windows.Forms.Panel
  Protected Overrides Sub OnPaint(ByVal myPEV As PaintEventArgs)
          Dim myRectF As RectangleF = New RectangleF(0, 0, Me.Width, Me.Height)
          Dim mySF As New StringFormat
          MyBase.OnPaint(myPEV)
          Dim myhDC As IntPtr = GetWindowDC(Me.Handle) 'from user32.dll
          Dim myGraphs As Graphics = Graphics.FromHdc(myhDC)
          If Me.Text IsNot Nothing Then
              mySF.Alignment = StringAlignment.Center
              mySF.LineAlignment = StringAlignment.Near
              myGraphs.DrawString(Me.Text, Me.Font, New SolidBrush(Me.ForeColor), myRectF, mySF)
              myGraphs.Dispose()
              ReleaseDC(Handle, myhDC) 'from user32.dll
          End If
      End Sub
  End Class
  </code></pre>