Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
' Make a brush that covers the form.
Dim graphics_path As New GraphicsPath
graphics_path.AddRectangle(Me.ClientRectangle)
Dim the_brush As New PathGradientBrush(graphics_path)
' Make a color blend from red to green to blue.
Dim color_blend As New ColorBlend
color_blend.Colors = New Color() {Color.Red, _
Color.Green, Color.Blue}
color_blend.Positions = New Single() {0.0, 0.5, 1.0}
the_brush.InterpolationColors = color_blend
' Make a pen from the brush.
Dim the_pen As New Pen(the_brush, 20)
the_pen.StartCap = LineCap.Round
the_pen.EndCap = LineCap.Round
' Draw some stuff.
e.Graphics.DrawEllipse(the_pen, 20, 20, _
Me.ClientSize.Width - 2 * 20, Me.ClientSize.Height _
- 2 * 20)
e.Graphics.DrawLine(the_pen, 20, 20, _
Me.ClientSize.Width - 20, Me.ClientSize.Height - 20)
e.Graphics.DrawLine(the_pen, Me.ClientSize.Width - 20, _
20, 20, Me.ClientSize.Height - 20)
the_pen.Dispose()
the_brush.Dispose()
End Sub
|