Actually, what you suggested got me thinking, so I did some more digging. As it turns out, I was trying to paint the wrong object. Apparently when using am MDI Parent form, the form itself is not the object you need to paint, but rather a control inside the form's ControlsCollection is used as the background. Apparently this control is automatically created when you specify that the form is am MDI Parent. Here is the code that works for me for anyone else that may encounter this issue:
Private WithEvents _MDIClient As MdiClient
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each objControl As Control In Me.Controls
If TypeOf objControl Is MdiClient Then
Me._MDIClient = objControl
Exit For
End If
Next
End Sub
Private Sub _MDIClient_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles _MDIClient.Paint
Me.DrawBackground(e.Graphics)
End Sub
Private Sub _MDIClient_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles _MDIClient.Resize
Me.DrawBackground(Me._MDIClient.CreateGraphics())
End Sub
Private Sub DrawBackground(ByVal objCanvas As Graphics)
Dim brushBlueGradient As LinearGradientBrush
brushBlueGradient = New LinearGradientBrush(Me.ClientRectangle, _
Color.FromArgb(115, 160, 196), _
Color.FromArgb(194, 213, 224), _
LinearGradientMode.Vertical)
objCanvas.Clear(Me._MDIClient.BackColor)
objCanvas.FillRectangle(brushBlueGradient, New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height))
End Sub
________________________
Ben Santiago, MCP & A+
Programmer Analyst (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS)
Eastern Suffolk BOCES - Student Data Services
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rich Cook