Mega Code Archive

 
Categories / VB.Net / 2D Graphics
 

Gradient Paint

Imports System.Drawing Public Class Form1     Inherits System.Windows.Forms.Form     Public Sub New()         MyBase.New()         Me.SuspendLayout()         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)         Me.BackColor = System.Drawing.Color.Gainsboro         Me.ClientSize = New System.Drawing.Size(400, 182)         Me.ResumeLayout(False)     End Sub     Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint         Dim objBrush As New Drawing2D.LinearGradientBrush(Me.DisplayRectangle, Color.Blue, Color.AliceBlue, Drawing2D.LinearGradientMode.Vertical)         Dim objGraphics As Graphics = Me.CreateGraphics()         objGraphics.FillRectangle(objBrush, Me.DisplayRectangle)         objBrush.Dispose()         objGraphics.Dispose()     End Sub End Class