Les Snippets

Connexion

arc en ciel en couleur de fond

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 02/08/2008 12:31:05 et initié par gillardg [Liste]
Vue : 1366
Catégorie(s) : Trucs & Astuces, WinForm, Graphique
Langage sélectionné : VB 2005
Langages dispo pour ce code :
- VB 2005, VB 2008
- Voir tous les langages pour ce code snippet



Langage : VB 2005 , VB 2008
Date ajout : 02/08/2008
Posté par gillardg [Liste]

''' <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


Snippets en rapport avec : Blend, Arc en ciel, Backcolor



Codes sources en rapport avec : Blend, Arc en ciel, Backcolor

{Delphi} ANIMER FENETRE
Programme d'apprentissage d'une fonction API Windows qu'est AnimateWindow(). C'est l'amélioration d...

{C / C++ / C++.NET} SKINNED MESH
hi ho, Un skinned mesh, le code source du SDK rebidouillé version plus simpliste. Pour ceux qui on...

{Visual Basic, VB6, VB.NET, VB 2005} RICHTEXTBOX AVANCÉE : AJOUTEZ FACILEMENT UNE LIGNE DE COULEUR, ET APPLIQUEZ UNE IMAGE FONDUE [MODULE DE CLASSE]
juste une classe pour ajouter une ligne de couleur avec le moins de tracas possible (ForeColor ET Ba...

{Visual Basic, VB6, VB.NET, VB 2005} DATETIMEPICKER DONT ON PEUT MODIFIER LA PROPRIÉTÉ BACKCOLOR
La propriété BackColor d'un contrôle DateTimePicker n'est pas modifiable, tout du moins elle n'appar...

{Visual Basic, VB6, VB.NET, VB 2005} TEXTBOX GRISÉ MALGRÉ UNE DÉFINITION BACKCOLOR
Lorsque l'on définit la couleur de fond d'un textbox, celui-ci est grisé, si sa propriété ReadOnly e...

{C / C++ / C++.NET} OPENGL MASKING
Voila cette demo montre comment realisé le masking et du scrolling en uilisant le Blend et montre co...