''' <summary> ''' Imports System.Drawing.Drawing2D ''' à utiliser dans Form_Paint (Event) ''' </summary> ''' <remarks></remarks> Sub DrawRainbowBlend() 'le code n'est pas de moi mais c'est tellement cool ! 'Simple Breakdown of creating a ColorBlend from scratch 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() { _ Color.Red, _ Color.Yellow, _ Color.Lime, _ Color.Cyan, _ Color.Blue, _ Color.Violet} blend.Colors = bColors 'Add the Array Single (0-1) colorpoints to place each Color Dim bPts As Single() = New Single() { _ 0, _ 0.327, _ 0.439, _ 0.61, _ 0.777, _ 1} blend.Positions = bPts ' Create a LinearGradientBrush or PathGradientBrush depending on the BlendGradientType choice Using br As New LinearGradientBrush(rect, Color.White, Color.Black, LinearGradientMode.Horizontal) '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
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.