2D Graphics VB.Net Tutorial

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class HatchStyle
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class
public class Form1
  Inherits System.Windows.Forms.Form
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        Dim x As Integer = 10
        Dim y As Integer = 20
        
        e.Graphics.Clear(Me.BackColor)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.BackwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Cross)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DarkDownwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DarkHorizontal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DarkUpwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DarkVertical)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DashedDownwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DashedHorizontal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DashedUpwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DashedVertical)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DiagonalBrick)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DiagonalCross)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Divot)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DottedDiamond)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.DottedGrid)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.ForwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Horizontal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.HorizontalBrick)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LargeCheckerBoard)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LargeConfetti)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LargeGrid)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LightDownwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LightHorizontal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LightUpwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.LightVertical)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.NarrowHorizontal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.NarrowVertical)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.OutlinedDiamond)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent05)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent10)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent20)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent25)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent30)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent40)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent50)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent60)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent70)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent75)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent80)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Percent90)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Plaid)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Shingle)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.SmallCheckerBoard)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.SmallConfetti)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.SmallGrid)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.SolidDiamond)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Sphere)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Trellis)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Vertical)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Wave)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.Weave)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.WideDownwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.WideUpwardDiagonal)
        DrawSample(e.Graphics, x, y, Drawing2D.HatchStyle.ZigZag)
    End Sub
    Private Sub DrawSample(ByVal gr As Graphics, ByRef x As Integer, ByRef y As Integer, ByVal hatch_style As Drawing2D.HatchStyle)
        gr.DrawString(hatch_style.ToString, Me.Font, Brushes.Black, x, y)
        Dim the_brush As New Drawing2D.HatchBrush(hatch_style, Color.Black, Color.White)
        gr.FillRectangle(the_brush, x, y + 15, 100, 20)
        y += 40
        If y + 40 > Me.ClientRectangle.Height Then
            x += 150
            y = 20
        End If
    End Sub
  Public Sub New()
   
    MyBase.New()
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(600, 600)
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  End Sub
End Class