Public Class Form1 ' Comment this out to see the annoying affect when you resize the form. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.SetStyle( _ ControlStyles.AllPaintingInWmPaint Or _ ControlStyles.ResizeRedraw, _ True) End Sub ' Draw an X that fills the form. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint e.Graphics.Clear(Me.BackColor) e.Graphics.DrawLine(Pens.Blue, 0, 0, Me.ClientSize.Width, Me.ClientSize.Height) e.Graphics.DrawLine(Pens.Blue, Me.ClientSize.Width, 0, 0, Me.ClientSize.Height) End Sub End Class |