How do I get this code to work from from the getgo? It works If I put it in the mouse events but not the controls paint event. I have tried adapting different methods from several threads but I cannot seem to get any of them to work.....

VB Code:
  1. Private Sub DrawGradientButton(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
  2.         Try
  3.             Dim g As Graphics = Button1.CreateGraphics
  4.             Dim rect As New Rectangle(0, 0, Button1.Width, Button1.Height)
  5.             Dim br As New System.Drawing.Drawing2D.LinearGradientBrush(rect, Color.White, Color.SlateGray, Drawing2D.LinearGradientMode.Horizontal)
  6.             Dim x As Single = CSng(Button1.Width / 2)
  7.             Dim y As Single = CSng(Button1.Height / 4)
  8.             Dim sBrush As New System.Drawing.SolidBrush(Color.WhiteSmoke)
  9.  
  10.             Dim Font As System.Drawing.Font = Button1.Font
  11.             Dim txt As String = Button1.Text
  12.  
  13.             g.FillRectangle(br, rect)
  14.             g.DrawString(txt, Font, sBrush, x, y)
  15.  
  16.             br.Dispose()
  17.             g.Dispose()
  18.  
  19.         Catch ex As Exception
  20.             MsgBox(ex.Message)
  21.         End Try
  22.     End Sub

Thank you!!

D