You need to get a reference to the MdiClient control that is embedded in your parent form and hosts the child forms. You then handle the Paint event of that, rather than the form. The following code uses the improved drawing code that I posted in that last thread of yours. Note the use of the OfType and First extension methods to get the MdiClient reference.vb.net Code:
Public Class Form1 Private WithEvents client As MdiClient Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As EventArgs) Handles MyBase.Load Me.client = Me.Controls.OfType(Of MdiClient).First() End Sub Private Sub client_Paint(ByVal sender As Object, _ ByVal e As PaintEventArgs) Handles client.Paint Using Brush As New Drawing2D.LinearGradientBrush(Me.client.Bounds, _ Color.FromArgb(0, 58, 140), _ Color.FromArgb(0, 215, 255), _ Drawing2D.LinearGradientMode.Vertical) e.Graphics.FillRectangle(Brush, Me.client.Bounds) End Using End Sub End Class




Reply With Quote