This is verbatim from a book...
VB Code:
  1. Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
  2.  
  3.     Dim g As Graphics = Me.CreateGraphics()
  4.  
  5.     Dim x As Integer = Me.Width
  6.     Dim y As Integer = Me.Height
  7.  
  8.     Dim lgb As LinearGradientBrush = New LinearGradientBrush(New Point(0, 0), New Point(x, y), Color.White, Color.Red)
  9.  
  10.     g.FillRectangle(lgb, 0, 0, x, y)
  11.  
  12. End Sub

It doesn't seem to do anything at all. It's supposed to show a gradient effect on the form, from white to red, top left to bottom right.

Can anyone get it working?