Graphics.FillShapes draws a shape and fills it in with the color given. Fill Shapes can use
Brush
Tool - to fill shape with a solid color
Dim rect As New Rectangle(50, 50, 50, 50)
e.Graphics.FillRectangle(Brushes.Green, rect) 'draws a rectangle that is filled with green
e.Graphics.FillPie(Brushes.Silver, rect, 0, 180) 'draws a half circle that is filled with silver
HatchBrush
Tool - to fill shape with a pattern
Dim hBrush As New HatchBrush(HatchStyle.ZigZag, Color.SkyBlue, Color.Gray)
'creates a HatchBrush Tool with a background color of blue, foreground color of gray,
'and will fill with a zigzag pattern
Dim rectan As New Rectangle(100, 100, 100, 100)
e.Graphics.FillRectangle(hBrush, rectan)
LinearGradientBrush
- to fill shape with a gradient
Dim lBrush As New LinearGradientBrush(point1, point2, Color.MediumVioletRed, Color.PaleGreen)
Dim rect As New Rectangle(50, 50, 200, 200)
e.Graphics.FillRectangle(lBrush, rect)
TextureBrush
- to fill shape with a picture
You can choose a picture from resources, an already defined Bitmap, or from a file name
Dim textBrush As New TextureBrush(New Bitmap("C:\ColorPic.jpg"))
Dim rect As New Rectangle(400, 400, 100, 100)
e.Graphics.FillPie(textBrush, rect, 0, 360)
Both the Hatch Brush Tool
and LinearGradientBrush
import the following statement : Imports System.Drawing.Drawing2D