Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim lgb As New LinearGradientBrush(ClientRectangle, Color.Honeydew, Color.Aquamarine, LinearGradientMode.Vertical)
e.Graphics.FillRectangle(lgb, ClientRectangle)
lgb.Dispose()
End Sub
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim lgb As New Drawing2D.LinearGradientBrush(ClientRectangle, Color.Honeydew, Color.Aquamarine, Drawing2D.LinearGradientMode.Vertical)
Dim bk As New Bitmap(Me.ClientRectangle.Width, Me.ClientRectangle.Height)
Dim g As Graphics = Graphics.FromImage(bk)
g.FillRectangle(lgb, ClientRectangle)
lgb.Dispose()
Me.BackgroundImageLayout = ImageLayout.Stretch
Me.BackgroundImage = bk
End Sub
ถ้ายังกระตุกอยู่ ก็ set property DoubbleBuffered ของ Form เป็น True ดูครับ