Texture-Brush with Rotate-Transform in VB.NET
A texture brush is an object that holds a picture and uses it to regularly fill the interior and geometric transformation can be used to translate, scale, rotate, or skew the image that defines the texture of this brush.
What is Texture-Brush
A texture brush is an object that holds a picture and uses it to regularly fill the interior of a closed shape.Textures is always a good stuff for a designer to spice out their work or masterpieces. To initialize it, you can use an existing picture designed by someone else or you can design your own picture using any normal graphics application, including Microsoft Paint. Each property of the TextureBrush class is a Brush object that uses an image to fill the interior of a shape. This class cannot be inherited.
The texture brushes provides you to use an image as brush and fill GDI+ objects with the brush. You need to define an Image object and create brush with that Image and pass the brush into Fill method of GDI+ objects.When I use a TextureBrush to fill a shape, the scaling for the tiling inherits from the previous transformation so the fill is inconsistent with the original 1:1 construction of the brush's bitmap and it changes in proportion to the dynamically computed scale
What is Rotate-Transform
A geometric transformation can be used to translate, scale, rotate, or skew the image that defines the texture of this brush. Rotate Transform is used for the process of rotating an element to a certain angle around a central point. At the time of using RotateTransform, realize that the transformation rotates the coordinate system for a particular object about the point (0, 0).
The Example given below which explain you how Texture-Brush works with Rotate-Transform.
Public Class MainClass
Shared Sub Main()
Dim window As Form = New Form()
Public Class Form
Private Sub draw(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim brush As New TextureBrush(New Bitmap("Sunset.jpg"))
brush.ScaleTransform(20, 15, MatrixOrder.Append)
e.Graphics.FillEllipse(brush, 70, 70, 70, 70)
Partial Public Class Form
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
Private components As System.ComponentModel.IContainer
Private Sub InitializeComponent()
Me.AutoScaleDimensions = New System.Drawing.SizeF(10.0!, 17.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(250, 250)
Me.Name = "Form"
Me.Text = ""