What your talking about is a gradient. Here is a simple example - create
a
form and drop a panel on it. I put a button in the panel as well, but it
doesn't do anything. I set the panel to anchor on all for sides:
Option Explicit On
Option Strict On
Option Infer Off
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Panel1_Paint( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Using gradient As Brush = New LinearGradientBrush( _
Panel1.ClientRectangle, _
Color.LightBlue, _
Color.DarkBlue, LinearGradientMode.Vertical)
e.Graphics.FillRectangle(gradient, Panel1.ClientRectangle)
End Using
End Sub
Private Sub Form1_SizeChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.SizeChanged
Me.Panel1.Invalidate(Panel1.ClientRectangle)
End Sub
End Class
You will notice some flickering as you resize - I make no attempt to
reduce
that. You could by using double buffering techniques.