''' <summary>
''' Imports System.Drawing.Drawing2D
''' dans Form_paint (Event)
''' exemple :
''' Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
''' blendit(Color.Blue, Color.Red, LinearGradientMode.ForwardDiagonal)
''' End Sub
''' </summary>
''' <param name="colorA"></param>
''' <param name="colorB"></param>
''' <param name="gradientMode"></param>
''' <remarks></remarks>
Sub blendit(ByVal colorA As Color, ByVal colorB As Color, ByVal gradientMode As LinearGradientMode)Dim g As Graphics = Me.CreateGraphics
g.SmoothingMode = SmoothingMode.AntiAlias
Dim rect As Rectangle = New Rectangle(0, 0, Me.Width, Me.Height)
Dim blend As ColorBlend = New ColorBlend()
'Add the Array of Color
Dim bColors As Color() = New Color() {colorA, colorB}
blend.Colors = bColors
'Add the Array Single (0-1) colorpoints to place each Color
Dim bPts As Single() = New Single() {0, 1.0}
blend.Positions = bPts
' Create a LinearGradientBrush or PathGradientBrush depending on the BlendGradientType choice
Using br As New LinearGradientBrush(rect, Color.White, Color.Black, gradientMode)
'Blend the colors into the Brush
br.InterpolationColors = blend
'Fill the rect with the blend
g.FillRectangle(br, rect)
End Using
'clean up graphics object
g.Dispose()
End Sub